I hope this is the proper way to do this. I'm new so please bear with me. I'm trying to write a script in autoit for runescape. If anyone is familiar with both or at least has better autoit skills than my noob self please reply. Again sense I don't know if this is the proper way to respond to this thread on this website I'm just going to attach the file and give a brief description of the request. I have a loop that mines coal from the barbarian village and banks it in Edgeville. The specific part I need tweaking on is how the script waits between mining the coal. I have it set up to pixelsearch for the coal, mouseclick the coal, and wait until there is a change using pixelchecksum somewhere in my Backpack. The request is how do I make it so that it does what I previously described plus research for the coal if there is no change in my backpack for a set amount of time. This is needed because sometimes the character takes forever to get the ore and it gets stolen by other players. If and when this happens my player just stands there waiting for the change to happen in my backpack which never does because someone else got the ore first.
HotKeySet("!{SPACE}", "TogglePause")
HotKeySet("{ESC}", "exitthescript")
HotKeySet("!a", "CoalRun")
Global $Paused
While (1)
Sleep(Random(1000, 2000, 1))
;remove semi colon to get it to start but beware it starts right away and you have to open the runescape window and be standing at the bank in edgevilleCoalRun()
WEnd
Func CoalRun()
;insert travel
LC4(1257, 295)
Long_Sleep()
LC4(1276, 298)
Sleep(Random(12500, 14000, 1))
LC4(1248, 225)
Small_Sleep()
$StillMining = True
While ($StillMining)
Sleep(Random(1000, 5000, 1))
SearchForCoal()
Wait()
$InvFull = PixelSearch(1315, 596, 1350, 625, 0x2D2D1C, 5)
If Not (@error) Then
$StillMining = False
EndIf
WEnd
LC4(1315, 72)
Med_Sleep()
LC4(1315, 72)
Med_Sleep()
LC4(1262, 133)
Med_Sleep()
$Banker = PixelSearch(480, 230, 964, 638, 0x876B90, 5);Change this to the color of the mob and the search area
If Not (@error) Then
LC2($Banker[0], $Banker[1])
Small_Sleep()
EndIf
LC3(753, 628)
VSmall_Sleep()
EndFunc ;==>CoalRun
Func SearchForCoal()
$Searching = True
While ($Searching)
$Coal = PixelSearch(565, 226, 831, 471, 0x272B28, 1)
If Not (@error) Then
LC($Coal[0], $Coal[1])
$Searching = False
EndIf
WEnd
EndFunc ;==>SearchForCoal
Func Wait()
$Waiting = True
Local $Gotone = PixelChecksum(1165, 377, 1352, 629)
While ($Gotone) = PixelChecksum(1165, 377, 1352, 629)
If Not (@error) Then
$Waiting = False
EndIf
WEnd
EndFunc ;==>Wait
Func LC($x, $y)
MouseClick("Left", $x - (Random(-3, 3, 1)), $y - (Random(-3, 0, 1)))
EndFunc ;==>LC
Func LC2($x, $y)
MouseClick("Left", $x - (Random(-5, 5)), $y - (Random(-5, 5)), 1, 10);this Left Click is in a random 10x10 square
EndFunc ;==>LC2
Func LC3($x, $y)
MouseClick("Left", $x - (Random(-10, 10)), $y - (Random(-10, 10)), 1, 10);this Left Click is in a random 20x20 square
EndFunc ;==>LC3
Func LC4($x, $y)
MouseClick("Left", $x - (Random(-1, 1)), $y - (Random(-1, 1)), 1, 10);this Left Click is in a random 20x20 square
EndFunc ;==>LC4
Func VSmall_Sleep()
Sleep(Random(1538, 2552, 1))
EndFunc ;==>VSmall_Sleep
Func Small_Sleep()
Sleep(Random(5558, 7375, 1))
EndFunc ;==>Small_Sleep
Func Med_Sleep()
Sleep(Random(11052, 15069, 1))
EndFunc ;==>Med_Sleep
Func Long_Sleep()
Sleep(Random(18192, 21887, 1))
EndFunc ;==>Long_Sleep
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused = SCRIPT IS NOT RUNNING = press Space to unpause."', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func exitthescript()
Exit
EndFunc ;==>exitthescript