A few changes I made that may be beneficial at a later date include
-Click Variation (It clicks within X pixels of the target)
While Im not sure if its needed... it will make it so that I am not clicking the same pixels everytime. It makes me feel a tad better since Blizz wont see and exact match for each run.
Code:
;Clicks near selected pixel
Func RandClick($clickType, $xPos, $yPos, $xOff = 10, $yOff = 10)
$randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
$randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
MouseClick($clickType, $randX, $randY)
EndFunc
;Moves mouse near selected pixel
Func RandMove($xPos, $yPos, $xOff = 10, $yOff = 10)
$randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
$randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
MouseMove($randX, $randY)
EndFunc
-Room Checking (It ensures you are in the proper room before continuing the script... if you aren't, it restarts the run)
It checks the upper right corner for the room name to appear, This gets rid of the lag issue I sometimes have where it thinks I should be in the cellar, but instead im running around outside. Saves me a bit of time on failed runs.
Code:
Func CheckFor($room, $tolerance = 100)
$c = 0
$string = "D:\Users\Shimizoki\Desktop\D3 Stuff\AutoIt\Images\" & $room & ".png"
Do
Sleep(100)
$c +=1
If $c > 50 Then ;Make sure we never get stuck here for infinity.
Return False
EndIf
Until _ImageSearchArea($string,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$tolerance)
Return True
EndFunc
both of these could of course be improved upon... but over all it makes me run slightly faster due to aborting failed runs better.