yeah its slow. I modded mine. try using this VillageSearch.au3 and GetResources.au3, it's so much faster. Beware if you have a slow pc then this will bug out:
Code:
;Searches for a village that until meets conditions
Func VillageSearch($TakeSS = 0) ;Control for searching a village that meets conditions
;If _Sleep(1000) Then Return
_CaptureRegion() ; Check Break Shield button again
If _ColorCheck(_GetPixelColor(513, 416), Hex(0x5DAC10, 6), 50) Then
Click(513, 416);Click Okay To Break Shield
EndIf
While 1
Switch $iradAttackMode
Case 0
SetLog("============Searching For Dead Bases============", $COLOR_BLUE)
Case 1
SetLog("============Searching For Weak Bases============", $COLOR_BLUE)
Case 2
SetLog("============Searching For All Bases============", $COLOR_BLUE)
EndSwitch
SetLog("~Gold: " & $MinGold & "; Elixir: " & $MinElixir & "; Dark: " & $MinDark & "; Trophy: " & $MinTrophy & "; Townhall: " & $MaxTH, $COLOR_GREEN)
If $TakeSS = 1 Then SetLog("Will capture snapshots of all towns when searching", $COLOR_GREEN)
$SearchCount = 0
$NoLeague = 0
_BlockInputEx(3, "", "", $HWnD)
While 1
_WinAPI_EmptyWorkingSet(WinGetProcess($Title)) ; Reduce BlueStacks Memory Usage
If _Sleep(1500) Then ExitLoop (2)
;setLog("check base",$COLOR_BLUE);
GetResources() ;Reads Resource Values
If $Restart = True Then ExitLoop (2)
;If CompareResources() Or ($THLoc = "Outside" And GUICtrlRead($chkMeetTHO) <> $GUI_CHECKED And GUICtrlRead($chkAttackTH) = $GUI_CHECKED) Then
If CompareResources() Then
;If $THLoc = "Outside" And GUICtrlRead($chkMeetTHO) <> $GUI_CHECKED And GUICtrlRead($chkAttackTH) = $GUI_CHECKED Then
;SetLog("~~~~~~~Outside Townhall Found!~~~~~~~", $COLOR_PURPLE)
;ExitLoop
If $iradAttackMode = 0 Then
If checkDeadBase() Then
SetLog("~~~~~~~Dead Base Found!~~~~~~~", $COLOR_GREEN)
ExitLoop
Else
;If _Sleep(1000) Then ExitLoop (2)
SetLog("~~~~~~~Not a dead base, skipping~~~~~~~", $COLOR_ORANGE)
If $TakeSS = 1 Then
Local $Date = @MDAY & "." & @MON & "." & @YEAR
Local $Time = @HOUR & "." & @MIN & "." & @SEC
_CaptureRegion()
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\AllTowns\" & $Date & " at " & $Time & ".png")
EndIf
GUICtrlSetData($lblresultvillagesskipped, GUICtrlRead($lblresultvillagesskipped)+1)
Click(750, 500) ;Click Next
EndIf
Else
ExitLoop
EndIf
Else
;If _Sleep(1000) Then ExitLoop (2)
GUICtrlSetData($lblresultvillagesskipped, GUICtrlRead($lblresultvillagesskipped)+1)
Click(750, 500) ;Click Next
EndIf
WEnd
If GUICtrlRead($chkAlertSearch) = $GUI_CHECKED Then
TrayTip("Match Found!", "Gold: " & $searchGold & "; Elixir: " & $searchElixir & "; Dark: " & $searchDark & "; Trophy: " & $searchTrophy, "", 0)
If FileExists(@WindowsDir & "\media\Windows Exclamation.wav") Then
SoundPlay(@WindowsDir & "\media\Windows Exclamation.wav", 1)
Else
SoundPlay(@WindowsDir & "\media\Festival\Windows Exclamation.wav", 1)
EndIf
EndIf
SetLog("===============Searching Complete===============", $COLOR_BLUE)
readConfig()
_BlockInputEx(0, "", "", $HWnD)
ExitLoop
WEnd
EndFunc ;==>VillageSearch
Code:
;Uses the getGold,getElixir... functions and uses CompareResources until it meets conditions.
;Will wait ten seconds until getGold returns a value other than "", if longer than 10 seconds - calls checkNextButton
;-clicks next if checkNextButton returns true, otherwise will restart the bot.
Func GetResources() ;Reads resources
While 1
Local $i = 0
_CaptureRegion()
Local $pixel1[3] = [3, 4, 0xEEF2F6], $pixel2[3] = [855, 5, 0xFEFFFF], $pixel3[3] = [3, 671, 0xEFF4F6]
While boolPixelSearch($pixel1, $pixel2, $pixel3)
If _Sleep(500) Then ExitLoop (2)
_CaptureRegion()
WEnd
While getGold(51, 66) = "" ; Loops until gold is readable
If _Sleep(100) Then ExitLoop (2)
;setLog("reading gold",$COLOR_BLUE);
$i += 1
If $i >= 100 Then ; If gold cannot be read by 10 seconds
If checkNextButton() Then
Click(750, 500) ;Click Next
Else
SetLog("Cannot locate Next button, Restarting Bot", $COLOR_RED)
checkMainScreen()
$Restart = True
ExitLoop (2)
EndIf
$i = 0
EndIf
WEnd
;If _Sleep(300) Then ExitLoop (2)
$searchTH = checkTownhall()
$searchGold = getGold(51, 66)
$searchElixir = getElixir(51, 66 + 29)
$searchTrophy = getTrophy(51, 66 + 90)
If $searchTrophy <> "" Then
$searchDark = getDarkElixir(51, 66 + 57)
Else
$searchDark = 0
$searchTrophy = getTrophy(51, 66 + 60)
EndIf
If $THx > 227 And $THx < 627 And $THy > 151 And $THy < 419 And $searchTH <> "-" Then
$THLoc = "Inside"
Elseif $searchTH <> "-" Then
$THLoc = "Outside"
Else
$THLoc = $searchTH
$THx = 0
$THy = 0
EndIf
$SearchCount += 1 ; Counter for number of searches
SetLog("(" & $SearchCount & ") [G]: " & $searchGold & Tab($searchGold, 7) & "[E]: " & $searchElixir & Tab($searchElixir, 7) & "[D]: " & $searchDark & Tab($searchDark, 7) & "[T]: " & $searchTrophy & Tab($searchTrophy, 5) & "[TH]: " & $searchTH & ", " & $THLoc, $COLOR_BLUE)
ExitLoop
WEnd
EndFunc ;==>GetResources