You need to capture the starting value of
A_TickCount and compare the current value to that since the actual value is not meaningful unless you really care about how long it has been since the system was started, as opposed to how much time has elapsed since your loop started.
Code: Select all
CoordMode, Pixel, Relative
sleep, 10000
Start := A_TickCount
Loop
{
PixelSearch, x, y, 759, 610, 763, 615, 0xE5464F
if (ErrorLevel = 0)
{
Random, rand, 110000, 113000
Sleep, %rand%
Click, Down, 1093 493
Click, Up, 1135 493
sleep, 300
send ^c
sleep, 400
Click, 767, 558
sleep, 400
Send ^v
Sleep 1000
Click, 767, 558
sleep, 300,
Click, 851, 619
sleep, 500
}
if (ErrorLevel = 0) and ((A_TickCount - Start) < 870000)
{
fullScriptPath = C:\Users\Vetx\Desktop\CODE.ahk
DetectHiddenWindows, On
WinClose, %fullScriptPath% ahk_class AutoHotkey
sleep, 500
}
}
Looks like you were also missing a
}, which is easier to see if you indent it like I showed.
Since your first
if block has the same condition as one of the conditions of your second one, you could structure it like this without the compound condition for the second one:
Code: Select all
CoordMode, Pixel, Relative
sleep, 10000
Start := A_TickCount
Loop
{
PixelSearch, x, y, 759, 610, 763, 615, 0xE5464F
if (ErrorLevel = 0)
{
Random, rand, 110000, 113000
Sleep, %rand%
Click, Down, 1093 493
Click, Up, 1135 493
sleep, 300
send ^c
sleep, 400
Click, 767, 558
sleep, 400
Send ^v
Sleep 1000
Click, 767, 558
sleep, 300,
Click, 851, 619
sleep, 500
if ((A_TickCount - Start) < 870000)
{
fullScriptPath = C:\Users\Vetx\Desktop\CODE.ahk
DetectHiddenWindows, On
WinClose, %fullScriptPath% ahk_class AutoHotkey
sleep, 500
}
}
}