So i have a loop, for example:
F1::
loop,
{
sleep 3000
Click, down, left
}
return
How do I cancel a loop after a specific amount of time and run a different code. So cancel the loop after 16 minutes and run a diffrent command like " send {wheelUp} " or whatever, and after turn the loop back on.
"'
cancel loop temporary
-
- Posts: 2
- Joined: 13 Mar 2020, 14:41
Re: cancel loop temporary
A easy way to do it would be to use a timer rather than a loop.
***Edit***
Seeing as you might be rather new to this sort of thing. Here is a little example that runs one bit of code every 3 seconds and another bit of code every 16 mins.
Code: Select all
Numpad1::
if(Tog:=!Tog){
SetTimer, SomeAction, 3000
Counter := 0
}else{
SetTimer, SomeAction, Off
ToolTip,
}
return
SomeAction:
ToolTip, % "Action Count: " ++Counter
return
Seeing as you might be rather new to this sort of thing. Here is a little example that runs one bit of code every 3 seconds and another bit of code every 16 mins.
Code: Select all
Numpad1::
if(Tog:=!Tog){
SetTimer, SomeAction, 3000
SetTimer, SomeOtherAction, % 1000 * 60 * 16 ;16 mins
Counter := 0
}else{
SetTimer, SomeAction, Off
SetTimer, SomeOtherAction, Off
ToolTip,
}
return
SomeAction:
ToolTip, % "Action Count: " ++Counter
return
SomeOtherAction:
msgbox, Some Other Action
return
-
- Posts: 2
- Joined: 13 Mar 2020, 14:41
Re: cancel loop temporary
Im so confused and i really can't wrap my head around this ive been trying to figure out for 45 min. This is the code I have for a game, how would I cancel the loop, or set a timer, so I could use different code for a bit and then turn the loop back on, or reset the timer.
Code: Select all
CoordMode, Mouse, Client
CoordMode, Pixel, Client
send {f1}
f12::Reload
send {f1}
F2::pause, toggle
F1::
loop,
{
sleep 3000
Click, down, left
send {w down}
sleep, 120000
Click, up, left
send {w up}
sleep, 2000
send {WheelUp}
sleep 700
Click
sleep 700
send {click, 967, 402}
sleep 700
loop 13
{
send {click, 1180, 255}
sleep 300
}
send {click, 1170, 900}
sleep 700
send {click, 970, 550}
sleep 700
send {click, 1180, 320}
sleep 1000
send {click, 1170, 790}
sleep 700
send {Shift down}
sleep 300
send {click}
sleep 300
send {Shift up}
sleep 700
send {Esc}
sleep 300
send {WheelDown}
}
return