Page 1 of 1

Need a little help please

Posted: 13 Jul 2018, 19:42
by HerrTrigger
Trying to write a script to hold down “w” and “LShift” while also repeatedly pressing “c” in a game.

Got this so far but it doesn’t work

toggle := 0
0::
toggle := !toggle
if (toggle) {
SetTimer, Timer_Spam, 10
} else {
SetTimer, Timer_Spam, Off
}
return

Timer_Spam:
Send {c}
Sleep 800
Send {w, Down}
Send {LShift, Down}
return

Re: Need a little help please

Posted: 14 Jul 2018, 11:36
by Qysh

Code: Select all

*0:: ; Before: 0::
toggle := !toggle
if (toggle) {
SetTimer, Timer_Spam, 10
} else {
SetTimer, Timer_Spam, Off
Send {w Up} ; Release the Key 
Send {LShift Up} ; Release the Key 
}
return

Timer_Spam:
Send {c}
Sleep 800
Send {w Down} ; Before: Send {w, Down}
Send {LShift Down} ; Before: Send {LShift, Down}
return
or

Code: Select all

*0:: ; Before: 0::
toggle := !toggle
if (toggle) {
SetTimer, Timer_Spam, 10
} else {
Gosub, sendDown
SetTimer, Timer_Spam, Off
Send {w Up} ; Release the Key 
Send {LShift Up} ; Release the Key 
}
return

sendDown:
Send {w Down} ; Before: Send {w, Down}
Send {LShift Down} ; Before: Send {LShift, Down}
return

Timer_Spam:
Send {c}
Sleep 800
return