Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 8:55 am

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 935 posts ]  Go to page 1, 2, 3, 4, 5 ... 38  Next
Author Message
 Post subject: [Feature] AutoMove Key
PostPosted: Sun Oct 12, 2008 3:22 pm 
Offline
Knowledgeable
User avatar

Joined: Tue Feb 06, 2007 9:50 pm
Posts: 180
Location: Bergenfield, New Jersey, US
Difficulty: 1/5 - Copy & Paste

This will make it so that if you press insert, you will automatically walk in that direction. To stop it you can either press any direction or insert again. This will also work in a map transition. Very basic. I also fixed a thing where if you are holding down a direction key and press insert and you let go of the direction it wont have an effect now. Try it out.

All client side.

Go into modGlobals and add this:
Code:
Public AutoMove As Boolean


Under:
Code:
Public ControlDown As Boolean


Replace the whole sub:
Code:
Sub CheckInput(ByVal KeyState As Byte, ByVal KeyCode As Integer, ByVal Shift As Integer)


With this:
Code:
Sub CheckInput(ByVal KeyState As Byte, ByVal KeyCode As Integer, ByVal Shift As Integer)
    If Not GettingMap Then
        If KeyState = 1 Then
            Select Case KeyCode
               
                Case vbKeyReturn
                    CheckMapGetItem
                   
                Case vbKeyControl
                    ControlDown = True
                   
                Case vbKeyShift
                    ShiftDown = True
                   
                Case vbKeyUp
                    DirDown = False
                    DirLeft = False
                    DirRight = False
                   
                    If AutoMove Then
                        DirUp = False
                        AutoMove = False
                    Else
                        DirUp = True
                    End If
                   
                Case vbKeyDown
                    DirUp = False
                    DirLeft = False
                    DirRight = False
                   
                    If AutoMove Then
                        DirDown = False
                        AutoMove = False
                    Else
                        DirDown = True
                    End If
                   
                Case vbKeyLeft
                    DirUp = False
                    DirDown = False
                    DirRight = False
                   
                    If AutoMove Then
                        DirLeft = False
                        AutoMove = False
                    Else
                        DirLeft = True
                    End If
                   
                Case vbKeyRight
                    DirUp = False
                    DirDown = False
                    DirLeft = False
                   
                    If AutoMove Then
                        DirRight = False
                        AutoMove = False
                    Else
                        DirRight = True
                    End If
                   
                Case vbKeyInsert
                    If Not AutoMove Then
                        AutoMove = True
                       
                        Select Case GetPlayerDir(MyIndex)
                       
                            Case DIR_UP
                                DirUp = True
                           
                            Case DIR_DOWN
                                DirDown = True
                           
                            Case DIR_LEFT
                                DirLeft = True
                           
                            Case DIR_RIGHT
                                DirRight = True
                       
                        End Select
                    Else
                        AutoMove = False
                       
                        Select Case GetPlayerDir(MyIndex)
                       
                            Case DIR_UP
                                DirUp = False
                               
                            Case DIR_DOWN
                                DirDown = False
                               
                            Case DIR_LEFT
                                DirLeft = False
                               
                            Case DIR_RIGHT
                                DirRight = False
                               
                        End Select
                       
            End Select
        Else
            Select Case KeyCode
               
                Case vbKeyUp
                    If Not AutoMove Then
                        DirUp = False
                    End If
                   
                Case vbKeyDown
                    If Not AutoMove Then
                        DirDown = False
                    End If
                   
                Case vbKeyLeft
                    If Not AutoMove Then
                        DirLeft = False
                    End If
                   
                Case vbKeyRight
                    If Not AutoMove Then
                        DirRight = False
                    End If
                   
                Case vbKeyShift
                    ShiftDown = False
                   
                Case vbKeyControl
                    ControlDown = False
                   
            End Select
        End If
    End If
End Sub


Go to:
Code:
Public Sub GameLoop()


and comment out:
Code:
            If GetAsyncKeyState(VK_UP) >= 0 Then DirUp = False
            If GetAsyncKeyState(VK_DOWN) >= 0 Then DirDown = False
            If GetAsyncKeyState(VK_LEFT) >= 0 Then DirLeft = False
            If GetAsyncKeyState(VK_RIGHT) >= 0 Then DirRight = False


then go to:
Code:
Sub HandlePlayerData(ByRef Parse() As String)


and replace:
Code:
     If i = MyIndex Then
         DirUp = False
         DirDown = False
         DirLeft = False
         DirRight = False
     End If


with:
Code:
     If i = MyIndex Then
         If Not AutoMove Then
             DirUp = False
             DirDown = False
             DirLeft = False
             DirRight = False
         End If
     End If


and that's it. Tell me if I missed anything. Again, its very basic didn't want to go and make it real complicated.

Edit: Will optimize later on.


Top
 Profile  
 
PostPosted: Tue Oct 14, 2008 10:26 pm 
Offline
Knowledgeable
User avatar

Joined: Tue Feb 06, 2007 9:50 pm
Posts: 180
Location: Bergenfield, New Jersey, US
Improved a little bit. Should work faster now.


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 8:06 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffuserhttp://semiasphalticflux.rusemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchuckинфоtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimate.rutemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:05 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Econ


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:06 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
59.7


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:07 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Bett


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:08 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Bett


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:09 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Fran


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:11 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Bill


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:12 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Unio


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:13 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Pier


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:15 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Geor


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:17 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Jewe


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:18 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Batt


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:20 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Fusi


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:27 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Epso


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:28 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Fisk


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:30 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Alle


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:31 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
XIII


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:33 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Sied


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:35 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Adam


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:36 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
WINX


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:37 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
John


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:38 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
XVII


Top
 Profile  
 
PostPosted: Thu Dec 30, 2021 2:40 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489086
Aris


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 935 posts ]  Go to page 1, 2, 3, 4, 5 ... 38  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 38 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group