Toggle for Shift + W won't toggle off

Ask gaming related questions (AHK v1.1 and older)
Orcanus
Posts: 1
Joined: 23 Nov 2017, 00:47

Toggle for Shift + W won't toggle off

23 Nov 2017, 00:52

Hello! Been using AHK for awhile now, and i'm not so much of a writer as I am a copier. Nonetheless, I enjoy the program a lot, but i'm having trouble with a script i'm trying to use. It's meant to hold down Shift + W upon a button press, until the same button is pressed again, to create the action of sprint moving.

The code is here:

toggle = 0
#MaxThreadsPerHotkey 2;
Numpad5::
Toggle := !Toggle
While Toggle{
Send {W Down}
Send {Shift Down}
}
return

My problem is that once the macro is toggled on, it won't toggle off unless the script is forcibly shut down. Can anyone help me fix this problem?
Rohwedder
Posts: 7612
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Toggle for Shift + W won't toggle off

23 Nov 2017, 04:56

Hallo,
try:

Code: Select all

toggle = 0
NumpadClear:: ;NumpadClear = Shift + Numpad5
Numpad5::
Toggle := !Toggle
While Toggle{
Send {Shift Down}
Send {w Down}
Sleep, 50
}
Send {Shift up}
Send {w up}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 52 guests