Pages (55):    124 25 26 27 2855   
mathdarkmoon   02-01-2015, 11:44 AM
been testing the newest release of safar64 for almost 6 hours and it worked like a charm...

the deadbase function with background hidden is really awesome, really great work.

Thank you very much for sharing this bot for free :-D

Problems encountered are very few maybe because its under development,

Here's the bugs:

1. When attack TH (outside) is ticked, when found a base which TH is at lower left the screen goes maximized.

2. Attack combination/deploy, using all troops and barb+arch+goblin (which I tested) it shows error and bot automatically exit.
2.1 Found the bug, attack combination with goblin, any combination that will include goblin the error appears and saying "variable used without being declared".... hope it helps

But this release was very great... hail to you safar64, sorry for my crappy english.

[Image: sigpic4011302_1.gif]
Kaz   02-01-2015, 12:06 PM
Rubber   02-01-2015, 12:25 PM
(02-01-2015, 12:06 PM)Kaz Wrote: @safar46 Amazing work! Very impressed with your contribution!

what kaz said and congrats on the promotion lol. not complaining but can you direct me to where in the code I can modify it so that after training on 4th barrack, that the script can automatically close it so that donations will work during wait time
k3iroll   02-01-2015, 12:45 PM
Guys,

After the 6th hours mark.
Got kicked out from game.
After several minutes bot restarts CoC.
Then just sits there clicking my wall and doing absolutely nothing else.

Anybody experience this?
safar46   02-01-2015, 12:50 PM
Thanks all for the reports. update fix work in progress for barrack 4. since now im TH5 i only have 3 barracks, lol.
so, i dont know whats happen if barrack 4 is available.
also fix for atkAlgorithm...

Sorry if this version have many bugs and can't be stable for now. because:
1. im re-modified some code to make it better
2. im not have much time to more test it, so i just release it and then see what users report here...
-=*[Swoop]*=-   02-01-2015, 12:54 PM
2015-02-01 13:45:29 : ~~~~Welcome to COC Bot v5.4.2.4 Safar46's Mods!~~~~
2015-02-01 13:45:29 : Au3 Script running on X64 OS
2015-02-01 13:45:29 : Bot is starting...
2015-02-01 13:45:30 : Trying to locate Main Screen
2015-02-01 13:45:30 : Main Screen Located
2015-02-01 13:45:32 : Zoomed Out
2015-02-01 13:45:33 : Collecting Resources
2015-02-01 13:45:37 : Collecting Complete
2015-02-01 13:45:38 : Training Troops...
2015-02-01 13:45:41 : Training Troops Complete
2015-02-01 13:45:43 : Requesting for Clan Castle's Troops
2015-02-01 13:45:49 : Donating for Clan Castle's Troops
2015-02-01 13:45:58 : Find a match...
2015-02-01 13:46:04 : ============Searching For Dead Base============
2015-02-01 13:46:04 : ~Gold: 180000; Elixir: 180000; Dark: 0; Trophy: 0; Townhall: 10
2015-02-01 13:46:06 : Error cannot check for Dead Base, Attacking...
2015-02-01 13:46:06 : (1) [G]: 88116 [E]: 123058 [D]: 1442 [T]: 15 [TH]: 7 [THL]: Outside
2015-02-01 13:46:06 : Error cannot check for Dead Base, Attacking...
2015-02-01 13:46:06 : Error cannot check for Dead Base, Attacking...
2015-02-01 13:46:06 : Error cannot check for Dead Base, Attacking...
2015-02-01 13:46:06 : Error cannot check for Dead Base, Attacking...
2015-02-01 13:46:06 : ~~~~~~~Dead Base Found!~~~~~~~
2015-02-01 13:46:08 : ===============Searching Complete===============
2015-02-01 13:46:09 : Preparing to attack
2015-02-01 13:46:09 : -Barbarian 151
2015-02-01 13:46:09 : -Archer 69
2015-02-01 13:46:09 : -Clan Castle 1
2015-02-01 13:46:10 : ======Beginning Attack======
2015-02-01 13:46:10 : Townhall location (0, 0)
2015-02-01 13:46:11 : ~Attacking in all sides...
2015-02-01 13:46:12 : Dropping first wave of Barbarians
2015-02-01 13:46:12 : Getting Attack Townhall location...
2015-02-01 13:46:13 : Getting Attack Townhall location...
2015-02-01 13:46:13 : Getting Attack Townhall location...
2015-02-01 13:46:13 : Getting Attack Townhall location...
2015-02-01 13:46:13 : Getting Attack Townhall location...
2015-02-01 13:46:14 : Getting Attack Townhall location...
2015-02-01 13:46:14 : Getting Attack Townhall location...
2015-02-01 13:46:14 : Getting Attack Townhall location...
2015-02-01 13:46:14 : Getting Attack Townhall location...
2015-02-01 13:46:15 : Getting Attack Townhall location...
2015-02-01 13:46:15 : Getting Attack Townhall location...
2015-02-01 13:46:15 : Getting Attack Townhall location...
2015-02-01 13:46:15 : Getting Attack Townhall location...
2015-02-01 13:46:16 : Getting Attack Townhall location...
2015-02-01 13:46:16 : Getting Attack Townhall location...
2015-02-01 13:46:17 : Getting Attack Townhall location...
2015-02-01 13:46:17 : Attacking Townhall with first wave Barbarians
2015-02-01 13:46:17 : Attacking Townhall with first wave Barbarians
2015-02-01 13:46:18 : Attacking Townhall with first wave Barbarians
2015-02-01 13:46:18 : Attacking Townhall with first wave Barbarians
2015-02-01 13:46:18 : Attacking Townhall with first wave Barbarians
2015-02-01 13:46:20 : Dropping first wave of Archers
2015-02-01 13:46:20 : Attacking Townhall with first wave of Archers
2015-02-01 13:46:20 : Attacking Townhall with first wave of Archers
2015-02-01 13:46:21 : Attacking Townhall with first wave of Archers
2015-02-01 13:46:21 : Attacking Townhall with first wave of Archers
2015-02-01 13:46:22 : Attacking Townhall with first wave of Archers
2015-02-01 13:46:24 : Dropping second wave of Barbarians
2015-02-01 13:46:28 : Dropping second wave of Archers
2015-02-01 13:46:35 : Dropping Clan Castle
2015-02-01 13:46:36 : Dropping left over troops
2015-02-01 13:46:50 : ~Finished Attacking, waiting to finish
-=*[Swoop]*=-   02-01-2015, 12:56 PM
TH was *inside* but it seemed to get stuck. Just happened again, something isnt working.

[search]
searchGold=180000
searchElixir=180000
searchDark=0
searchTrophy=0
conditionGoldElixir=1
conditionDark=0
conditionTrophy=0
conditionGoldorElixir=0
conditionTownHall=0
conditionTownHallO=0
THLevel=4
[donate]
request=1
xCCPos=390
yCCPos=289
textrequest=default
checkbarb=1
checkbarball=0
barbarian=0
barb=0
barbany=1
checkarch=1
checkarchall=0
archer=1
arch=0
archany=0
checkgiant=0
checkgiantall=0
giants=0
giant=0
giantany=0
[attack]
deploy=2
algorithm=8
mode=0
king-dead=1
king-all=0
queen-dead=1
queen-all=0
townhall=1
spell=0
use-cc=1
[troop]
composition=8
troop1=1
troop2=0
troop3=1
troop4=1
xBarrack1=264
yBarrack1=407
xBarrack2=185
yBarrack2=298
xBarrack3=637
yBarrack3=380
xBarrack4=383
yBarrack4=476
capacity=0
giant=0
WB=0
spell=0
[general]
frmBotPosX=958
frmBotPosY=220
MaxTrophy=3210
Background=0
xCollector1=224
yCollector1=382
xCollector2=207
yCollector2=254
xCollector3=270
yCollector3=205
xCollector4=305
yCollector4=190
xCollector5=338
yCollector5=156
xCollector6=514
yCollector6=154
xCollector7=553
yCollector7=181
xCollector8=631
yCollector8=241
xCollector9=659
yCollector9=342
xCollector10=600
yCollector10=405
xCollector11=557
yCollector11=432
xCollector12=464
yCollector12=335
xCollector13=415
yCollector13=461
xCollector14=301
yCollector14=438
xCollector15=
yCollector15=
xCollector16=
yCollector16=
xCollector17=
yCollector17=
indy   02-01-2015, 01:06 PM
ALERT: long post

1. LocateTH
i've written this function and put a button to trigger it manually while visiting a village for testing purposes. what am i missing?
running 32bit exe, no th found. is there some other functions /variables to initiate before _CaptureRegion() ?

Code:
Func LocateTH() ; locates TH Global $atkTHs[5] = [$atkTH6,$atkTH7,$atkTH8,$atkTH9,$atkTH10] _CaptureRegion() $THLocation1 = 0 $searchTH1 = "-" for $i = 0 to 4 $THLocation1 = _ImageSearch($atkTHs[$i], 1, $THx1, $THy1, $Tolerance1) ; Getting TH Location If $THLocation1 = 1 Then if $i = 0 Then $searchTH1 = '"4-' & $i+6 & '"' Else $searchTH1 = '"' & $i+6 & '"' EndIf ExitLoop EndIf Next If $THx1 > 227 And $THx1 < 627 And $THy1 > 151 And $THy1 < 419 And $searchTH1 <> "-" Then $THLoc1 = "Inside" Else $THLoc1 = "Outside" EndIf SetLog("located townhall: " & $searchTH1 & " @" & $THx1 & "," & $THy1 & ". It's " & $THLoc1) EndFunc
this is the output
Code:
located townhall: - @0,0. It's -

2. revised CompareResources
this is my revised CompareResources to meet ALL conditions specified - (gold/elixir AND max th) - for example.
Code:
Func CompareResources() ;Compares resources and returns true if conditions meet, otherwise returns false If GUICtrlRead($chkMeetTH) <> $GUI_CHECKED Then $MaxTH = "-" EndIf If $SearchCount <> 0 And Mod($SearchCount, 20) = 0 Then If $MinGold - 2000 >= 0 Then $MinGold -= 2000 If $MinElixir - 2000 >= 0 Then $MinElixir -= 2000 If $MinDark - 100 >= 0 Then $MinDark -= 100 If $MinTrophy - 2 >= 0 Then $MinTrophy -= 2 SetLog("~Gold: " & $MinGold & "; Elixir: " & $MinElixir & "; Dark: " & $MinDark & "; Trophy: " & $MinTrophy & "; Townhall: " & $MaxTH) EndIf Local $G = (Number($searchGold) >= Number($MinGold)), $E = (Number($searchElixir) >= Number($MinElixir)), $D = (Number($searchDark) >= Number($MinDark)), $T = (Number($searchTrophy) >= Number($MinTrophy)) Local $THL = -1, $THLO = -1 Switch $searchTH Case "4-6" $THL = 0 Case "7" $THL = 1 Case "8" $THL = 2 Case "9" $THL = 3 Case "10" $THL = 4 EndSwitch Switch $THLoc Case "Inside" $THLO = 0 Case "Outside" $THLO = 1 EndSwitch Local $chkMeetGxE_bool = True Local $chkMeetDE_bool = True Local $chkMeetTrophy_bool = True Local $chkMeetGorE_bool = True Local $chkMeetTH_bool = True Local $chkMeetTHO_bool = True If GUICtrlRead($chkMeetGxE) = $GUI_CHECKED Then If $G = False Or $E = False Then $chkMeetGxE_bool = False EndIf EndIf If GUICtrlRead($chkMeetDE) = $GUI_CHECKED Then If $D = False Then $chkMeetDE_bool = False EndIf EndIf If GUICtrlRead($chkMeetTrophy) = $GUI_CHECKED Then If $T = False Then $chkMeetTrophy_bool = False EndIf EndIf If GUICtrlRead($chkMeetGorE) = $GUI_CHECKED Then If $G = False And $E = False Then $chkMeetGorE_bool = False EndIf EndIf If GUICtrlRead($chkMeetTH) = $GUI_CHECKED Then If $THL > _GUICtrlComboBox_GetCurSel($cmbTH) And ZombieSearch() = False Then $chkMeetTH_bool = False EndIf EndIf If GUICtrlRead($chkMeetTHO) = $GUI_CHECKED Then If $THLO <> 1 Then $chkMeetTHO_bool = False EndIf EndIf Local $Boolean = $chkMeetGxE_bool And $chkMeetDE_bool And $chkMeetTrophy_bool And $chkMeetGorE_bool And $chkMeetTH_bool And $chkMeetTHO_bool Return $Boolean EndFunc ;==>CompareResources

please note i've added the option to attack the base even if th > than specified IF that village is deadbase. don't know if could work as i'm having problems with deadbase/imagesearch as per first point

3. other issues
a. i would like to take screenshots of what the bot considers zombies or not dead bases when attacking with the option deadbase, testing purposes. this is what i've added
Code:
DirCreate(@ScriptDir & "\Dead\") DirCreate(@ScriptDir & "\unDead\")
and the modified villagesearch
Code:
Func VillageSearch() ;Control for searching a village that meets conditions While 1 Switch $iradAttackMode Case 0 SetLog("============Searching For Dead Base============") Case 1 SetLog("============Searching For Weak Base============") Case 2 SetLog("============Searching For All Base============") EndSwitch SetLog("~Gold: " & $MinGold & "; Elixir: " & $MinElixir & "; Dark: " & $MinDark & "; Trophy: " & $MinTrophy & "; Townhall: " & $MaxTH) $SearchCount = 0 $OptimizeSleep = 0 While 1 If _Sleep(1000) Then ExitLoop (2) GetResources() ;Reads Resource Values If $Restart = True Then ExitLoop (2) If CompareResources() Then If $iradAttackMode = 0 Then If ZombieSearch() Then SetLog("~~~~~~~Dead Base Found!~~~~~~~") Local $Date = @MDAY & "." & @MON & "." & @YEAR Local $Time = @HOUR & "." & @MIN& "." & @SEC _CaptureRegion() _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Dead\" & $Date & " at " & $Time & ".jpg") ExitLoop Else SetLog("~~~~~~~Not dead base, skipping~~~~~~~") Local $Date = @MDAY & "." & @MON & "." & @YEAR Local $Time = @HOUR & "." & @MIN & "." & @SEC _CaptureRegion() _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\unDead\" & $Date & " at " & $Time & ".jpg") Click(750, 500) ;Click Next EndIf Else ExitLoop EndIf Else Click(750, 500) ;Click Next EndIf WEnd If GUICtrlRead($chkAlertSearch) = $GUI_CHECKED Then TrayTip("Match Found!", "Gold: " & $searchGold & "; Elixir: " & $searchElixir & "; Dark: " & $searchDark & "; Trophy: " & $searchTrophy & "; Townhall: " & $searchTH & "", 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===============") readConfig() ExitLoop WEnd EndFunc ;==>VillageSearch

b.troop donation
i found out my clanmate with 30 spaces in clan castle wasn't getting troops donated. the solution has been to change every occurrence of
Code:
Click(($DonateTroop[0]+200), ($DonateTroop[1]-20),5) ; donate archer

with
Code:
Click(($DonateTroop[0]+200), ($DonateTroop[1]-30),5) ; donate archer

it seems to work fine with this change for everyone.

c. Train()
you have missed the last click to close the 4th barrack so the bot behaves weird
this is just the end of the function with the 2 lines to add back
Code:
EndIf If _Sleep(500) Then ExitLoop (2) Click(1, 1, 2, 250); Click away twice with 250ms delay Next SetLog("Training Troops Complete") ExitLoop WEnd EndFunc ;==>Train

d. idle()
i was thinking, is the "if" statement outside the "while" one necessary?
Code:
If $fullArmy = False Then While $fullArmy = False
by looking at the function i would say no, so we could clean more code

that's almost all, for now
saxmydix   02-01-2015, 01:07 PM
(02-01-2015, 12:50 PM)safar46 Wrote: Thanks all for the reports. update fix work in progress for barrack 4. since now im TH5 i only have 3 barracks, lol.
so, i dont know whats happen if barrack 4 is available.
also fix for atkAlgorithm...

Sorry if this version have many bugs and can't be stable for now. because:
1. im re-modified some code to make it better
2. im not have much time to more test it, so i just release it and then see what users report here...



train code dint click away to close barrack. just add this line from older script. work perfect.

Code:
Else If _Sleep(500) Then ExitLoop (2) Click(1, 1, 2, 250); Click away twice with 250ms delay ExitLoop  EndIf   EndIf If _Sleep(500) Then ExitLoop (2) Click(1, 1, 2, 250); Click away twice with 250ms delay Next SetLog("Training Troops Complete") ExitLoop WEnd EndFunc   ;==>Train
k3iroll   02-01-2015, 01:07 PM
Swoop,

I would suggest to try things below for the fix:

1- Try to re-install AutoIt
2- Delete config
3- Compile to x86
Pages (55):    124 25 26 27 2855   
  
Users browsing this thread: 1 Guest(s)
Konloch Software - Bytecode Viewer - Hack Log - Reverse Engineering Forum
Copyright © 2014-2026 The Bytecode Club. Powered By MyBB.
CC0 Unless Specified Otherwise.