Mirage Source
http://www.miragesource.net/forums/

[Feature] AutoMove Key
http://www.miragesource.net/forums/viewtopic.php?f=183&t=4543
Page 1 of 38

Author:  Ramsey [ Sun Oct 12, 2008 3:22 pm ]
Post subject:  [Feature] AutoMove Key

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.

Author:  Ramsey [ Tue Oct 14, 2008 10:26 pm ]
Post subject:  Re: [Feature] AutoMove Key

Improved a little bit. Should work faster now.

Author:  wanai [ Wed Dec 01, 2021 8:06 am ]
Post subject:  Re: [Feature] AutoMove Key

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffuserhttp://semiasphalticflux.rusemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchuckинфоtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimate.rutemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting

Author:  wanai [ Thu Dec 30, 2021 2:05 am ]
Post subject:  Re: [Feature] AutoMove Key

Econ

Author:  wanai [ Thu Dec 30, 2021 2:06 am ]
Post subject:  Re: [Feature] AutoMove Key

59.7

Author:  wanai [ Thu Dec 30, 2021 2:07 am ]
Post subject:  Re: [Feature] AutoMove Key

Bett

Author:  wanai [ Thu Dec 30, 2021 2:08 am ]
Post subject:  Re: [Feature] AutoMove Key

Bett

Author:  wanai [ Thu Dec 30, 2021 2:09 am ]
Post subject:  Re: [Feature] AutoMove Key

Fran

Author:  wanai [ Thu Dec 30, 2021 2:11 am ]
Post subject:  Re: [Feature] AutoMove Key

Bill

Author:  wanai [ Thu Dec 30, 2021 2:12 am ]
Post subject:  Re: [Feature] AutoMove Key

Unio

Author:  wanai [ Thu Dec 30, 2021 2:13 am ]
Post subject:  Re: [Feature] AutoMove Key

Pier

Author:  wanai [ Thu Dec 30, 2021 2:15 am ]
Post subject:  Re: [Feature] AutoMove Key

Geor

Author:  wanai [ Thu Dec 30, 2021 2:17 am ]
Post subject:  Re: [Feature] AutoMove Key

Jewe

Author:  wanai [ Thu Dec 30, 2021 2:18 am ]
Post subject:  Re: [Feature] AutoMove Key

Batt

Author:  wanai [ Thu Dec 30, 2021 2:20 am ]
Post subject:  Re: [Feature] AutoMove Key

Fusi

Author:  wanai [ Thu Dec 30, 2021 2:27 am ]
Post subject:  Re: [Feature] AutoMove Key

Epso

Author:  wanai [ Thu Dec 30, 2021 2:28 am ]
Post subject:  Re: [Feature] AutoMove Key

Fisk

Author:  wanai [ Thu Dec 30, 2021 2:30 am ]
Post subject:  Re: [Feature] AutoMove Key

Alle

Author:  wanai [ Thu Dec 30, 2021 2:31 am ]
Post subject:  Re: [Feature] AutoMove Key

XIII

Author:  wanai [ Thu Dec 30, 2021 2:33 am ]
Post subject:  Re: [Feature] AutoMove Key

Sied

Author:  wanai [ Thu Dec 30, 2021 2:35 am ]
Post subject:  Re: [Feature] AutoMove Key

Adam

Author:  wanai [ Thu Dec 30, 2021 2:36 am ]
Post subject:  Re: [Feature] AutoMove Key

WINX

Author:  wanai [ Thu Dec 30, 2021 2:37 am ]
Post subject:  Re: [Feature] AutoMove Key

John

Author:  wanai [ Thu Dec 30, 2021 2:38 am ]
Post subject:  Re: [Feature] AutoMove Key

XVII

Author:  wanai [ Thu Dec 30, 2021 2:40 am ]
Post subject:  Re: [Feature] AutoMove Key

Aris

Page 1 of 38 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/