I have also created another hotkey (Insert) to do certain things that I want to do.
When I hit hotkey (Insert) while the loop is ongoing, the commands under that hotkey does not finish before the loop begins again, because the loop has an interval of 250 ms.
How do I modify the code so that when I press the hotkey, the loop will stop by itself, do and finish all the command I have under that hotkey (Insert), then continue with the loop by itself again.
Below is my code. Thank you.
Code: Select all
Delete::
if (HitToggle1 := !HitToggle1){
SetTimer, Hit1, 250
GoSub, Hit1
} else {
SetTimer, Hit1, Off
}
return
Hit1:
if (IsSpace1 := !IsSpace1)
key1 := "Space"
else
key1 := CurrentDir1
ControlSend, ahk_parent, % "{" key1 "}", Fighter
return
Insert::
ControlSend, ahk_parent, u, Fighter
sleep 500
ControlSend, ahk_parent, a, Fighter
sleep 1500
ControlSend, ahk_parent, {Down}, Fighter
sleep 500
ControlSend, ahk_parent, {Enter}, Fighter
return