Reputation: 11
I'm fairly new to AHK and I was wondering how to put a toggle on this script so I can pause it immediately with XButton1 but also reactivate it at the same point in the loop if that is possible. I've tried looking for solutions but none of them suite my case here especially with trying to pause a loop.
XButton1::
SendInput {LButton down}
Loop, 27
{
SendInput {w down}{a down}
sleep 17500
SendInput {w up}{a up}
mouseMove, 52, 0, 20, R
SendInput {w down}{d down}
sleep 17500
SendInput {w up}{d up}
mouseMove, -52, 0, 20, R
}
return
Upvotes: 0
Views: 1274
Reputation: 6499
Seems like you're just simply looking for Pause
.
For example, toggling pause with Esc as your hotkey:
*Esc::Pause
Edit:
Just noticed you mentioned XButton1 being the pause key as well.
Does it have to be like that? It's surely doable, and I can show how to do it, but makes the thing a whole lot easier if you just have a different key for pausing.
Upvotes: 1