Code:
Random(min,max) {
Random, res, % min, % max
Return res
}
#4::
SetMouseDelay, % Random(50,65) ;#4, loop4, F4, FishBCheck, F7, repeat loop4 >
WinGetPos,,, x, y, A
GoSub, loop4
Return
Loop4:
Sleep, % Random(50,100)
SetMouseDelay, % Random(50,65)
GoSub, prelogout
GoSub, Huml
GoSub, F4
Return
F4:
Sleep, % Random(200,400)
SetKeyDelay, 4, 6,
Send {F4}
GoSub, prelogout
PixelSearch, Px, Py, 895, 320, 920, 345, 0x202876, 3, Fast
if ErrorLevel
GoSub, F4
else
Sleep, % Random(1500,1700)
GoSub FishBCheck
Return
FishBCheck:
Sleep, % Random(200,300)
GoSub, prelogout
PixelSearch, Px, Py, 836, 400, 852, 412, 0x7F6663, 3, Fast
if ErrorLevel
GoSub, FishBCheck
else
GoSub, I21L2
GoSub, F7
Return
F7:
Sleep, % Random(200,400)
GoSub, prelogout
SetKeyDelay, 4, 6,
Send {F7}
PixelSearch, Px, Py, 995, 320, 1020, 345, 0x1E2875, 3, Fast
if ErrorLevel
GoSub, F7
else
GoSub, loop4
Return
PreLogout:
PixelSearch, Px, Py, 995, 320, 1020, 345, 0x337095, 3, Fast
if ErrorLevel
GoSub, logout
else
sleep, 1
Return
Logout:
MouseClick, Left , % Random(1010,1020), % Random(150,165)
Sleep, % Random(500,2000)
MouseClick, Left , % Random(840,970), % Random(510,535)
Sleep, % Random(60000,120000)
Return
HumL:
MouseClick, Left , % Random(826,841), % Random(396,414)
Return
I21L2:
Sleep, % Random(150,250)
MouseClick, Left , % Random(836,852), % Random(400,412)
Return
Explanation what the script does.
Its a runescape humidify script. In short - it clicks on the 1st spot, after which it clicks F4 until the colour1 changes. It waits until the colour2 changes again and it clicks on the 2nd spot. It clicks F7 until the colour3 changes. During the script if colour4 changes it logs off the acc. and shuts down the pc.
Now the strange thing is - it runs for ~1000 casts of humidify (~ 1 hour and 10 minutes) after which the script/autohotkey crashes ... any idea why does this happen ?