How do I segment this script so it doesn't run everything in it Topic is solved

Ask gaming related questions (AHK v1.1 and older)
baconbankai
Posts: 6
Joined: 24 Jun 2018, 11:40

How do I segment this script so it doesn't run everything in it

10 Mar 2024, 17:50

I wasn't sure how to word the subject line in this case but rather than running multiple scripts I would like it all contained in one if possible. when I run this script my intent is to have each series of key strokes bound to a specific key but the script runs all the keystrokes to the very end depending on what key I pressed.

Code: Select all

;Reinforce

4::
Sleep, 10
Send {8 Down}
Sleep, 10
send {w}
Sleep, 10
send {s}
Sleep, 10
send {d}
Sleep, 10
send {a}
Sleep, 10
send {w}
Sleep, 10
Send {8 up}

return

;Resupply

5::
Sleep, 10
Send {8 Down}
Sleep, 10
send {s}
Sleep, 10
send {s}
Sleep, 10
send {w}
Sleep, 10
send {d}
Sleep, 10
Send {8 up}

return

;Exosuit

9::

Sleep, 10
Send {8 Down}
Sleep, 10
send {a}
Sleep, 10
send {s}
Sleep, 10
send {d}
Sleep, 10
send {w}
Sleep, 10
send {a}
Sleep, 10
send {s}
Sleep, 10
send {s}
Sleep, 10
Send {8 up}
return

;AC-8 Autocannon
6::

Sleep, 10
Send {8 Down}
Sleep, 10
send {s}
Sleep, 10
send {a}
Sleep, 10
send {s}
Sleep, 10
send {w}
Sleep, 10
send {w}
Sleep, 10
send {d}
Sleep, 10
Send {8 up}
return


;Orbital Railcannon Strike

-::

Sleep, 10
Send {8 Down}
Sleep, 10
send {s}
Sleep, 10
send {a}
Sleep, 10
send {s}
Sleep, 10
send {w}
Sleep, 10
send {w}
Sleep, 10
send {d}
Sleep, 10
Send {8 up}
return

;Eagle 500kg Bomb

=::

Sleep, 10
Send {8 Down}
Sleep, 10
send {w}
Sleep, 10
send {d}
Sleep, 10
send {s}
Sleep, 10
send {s}
Sleep, 10
send {s}
Sleep, 10
Send {8 up}

return
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
User avatar
boiler
Posts: 17328
Joined: 21 Dec 2014, 02:44

Re: How do I segment this script so it doesn't run everything in it

10 Mar 2024, 18:10

I can’t follow what you’re saying. The subject line says to segment it so it doesn’t run everything in it (it already is that way as it runs inly those lines associated with their hotkey), then you say you want it contained all in one script instead of multiple scripts (it already is in one script), and then your last sentence seems to contradict itself in that you want parts of it bound to a their specific keys but run all the way to the end.

You need to be much clearer in what you are trying to accomplish. Give examples. Perhaps terminology is part of the problem. Each hotkey routine isn’t a separate script. Everything in the same file is one script.
baconbankai
Posts: 6
Joined: 24 Jun 2018, 11:40

Re: How do I segment this script so it doesn't run everything in it  Topic is solved

10 Mar 2024, 18:25

I figured it out. I needed each bound key to perform only the section below it. I'm sorry I wasn't clear in my post I'm not as familiar with the verbiage so I had a hard time describing what I needed it to do. before if I hit "4" on my keybord it would send wsdaw, sswd, and the rest of the characters below now it just sends wsdaw as I was intending.


here's the updated script

Code: Select all

;Reinforce

4::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send w
Sleep, 10
send s
Sleep, 10
send d
Sleep, 10
send a
Sleep, 10
send w
Sleep, 10
Send {8 up}
}
return

;Resupply

5::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send s
Sleep, 10
send s
Sleep, 10
send w
Sleep, 10
send d
Sleep, 10
Send {8 up}
}
return

;Exosuit

9::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send a
Sleep, 10
send s
Sleep, 10
send d
Sleep, 10
send w
Sleep, 10
send a
Sleep, 10
send s
Sleep, 10
send s
Sleep, 10
Send {8 up}
}
return
;AC-8 Autocannon
6::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send s
Sleep, 10
send a
Sleep, 10
send s
Sleep, 10
send w
Sleep, 10
send w
Sleep, 10
send d
Sleep, 10
Send {8 up}
}

return
;Orbital Railcannon Strike

-::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send s
Sleep, 10
send a
Sleep, 10
send s
Sleep, 10
send w
Sleep, 10
send w
Sleep, 10
send d
Sleep, 10
Send {8 up}
}
return
;Eagle 500kg Bomb

=::
loop 1
{
Sleep, 10
Send {8 Down}
Sleep, 10
send w
Sleep, 10
send d
Sleep, 10
send s
Sleep, 10
send s
Sleep, 10
send s
Sleep, 10
Send {8 up}
}
Return



Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 25 guests