Newest 21s w/ Cellar Detection: [AutoIt] 21s w/ Cellar Check - Pastebin.com
Usage:
Code:
If FindCellar() = 1 Then
If CheckDead() Then
Return
EndIf
MouseClick("left",$cellarCoordx[$CellCoord],$cellarCoordy[$CellCoord],1)
Variables:
Code:
;Cellar Check HERE
$CellCoord = -1
$c = 0
$ScreenShotCloseCellar = 0 ;A helper to find different coordinates for cellar detection slows runs down about a second though.
$cellarCheckSleep = 135 ;Increase this if you find the script double clicking
;These correspond to eachother IE: coord 1 (255,290) coord 2 (175,305)
;If you add or change any of these remember to change line: "If $c = 5 then"
;to where ever in the array (600,435) is. Remember when reading the array it starts at 0
Global $cellarCoordx[6] = [255, 175, 315, 265, 280, 600]
Global $cellarCoordy[6] = [290, 305, 314, 340, 302, 435]
;====================================;
Main Function:
Code:
Func FindCellar()
$CellCoord = -1
$c = 0
Do
If $c >= Ubound($cellarCoordx) Then ;Make sure we never get stuck here for infinity.
If $CellCoord = -1 Then $CellCoord = 0
Return 0
EndIf
RandMove(Round($cellarCoordx[$c] * $x_ratio), Round($cellarCoordy[$c] * $y_ratio), 1, 1) ;moves cursor over to the cellar
$mousePos = MouseGetPos()
sleep($cellarCheckSleep)
If $c = 5 then
$Pixel2 = PixelSearch($mousePos[0] - 71 * $x_ratio,$mousePos[1] - 148 * $y_ratio,$mousePos[0] + 139 * $x_ratio,$mousePos[1] + 22 * $y_ratio, 0x007CB7F8, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
Else
$Pixel2 = PixelSearch($mousePos[0] - 71 * $x_ratio,$mousePos[1] - 148 * $y_ratio,$mousePos[0] + 139 * $x_ratio,$mousePos[1] + 22 * $y_ratio, 0x334FB7, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
EndIf
If Not @Error Then
$CellCoord = $c
Return 1
EndIf
$c += 1
Until $CellCoord >= 0
If $CellCoord = -1 Then $CellCoord = 0
Return
EndFunc