Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding WBs
#11
(01-20-2015, 08:46 AM)mine214 Wrote:  Thanks Barracoda,

I managed to implement your functions.
I even added the Global $Toggtroop = 0 as mentioned in post #5.
But I also get the error on line 18615. I do not get where this is coming from.
Any ideas?

I believe you are running the .exe file. I think if you run the .au3 file it's easier to check which line is having the issue.

Right click the .au3 file
Run Script (according to your system x64/x86)
Reply
#12
Is anyone running this with 200+ troops? If so, how many Giants & WBs are you getting?

I've modified it again to allow more Giants & WBs since I only have 185 capacity. I wasn't getting much out of the 4-5.
With the modified training, I now have 10-11 of each instead.

I would recommend the below changes for 150-200 capacity if you're not happy with the results of the previous modification. This will also be helpful in the event you have to stop & restart the bot as the Giants & WBs are now in different barracks.


Added WBs to options
Code:
$cmbBarrack1 = GUICtrlCreateCombo("", 275, 150, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants|Wallbreakers", "Giants") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack2 = GUICtrlCreateCombo("", 275, 175, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants|Wallbreakers", "Wallbreakers") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack3 = GUICtrlCreateCombo("", 275, 200, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants|Wallbreakers", "Barbarians") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack4 = GUICtrlCreateCombo("", 275, 225, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants|Wallbreakers", "Archers") ; "Barbarians|Archers|Giants|Goblins"


I've replaced Goblins in the part below with WBs. You could probably just add a new Case for them though. Be sure to update troop options when you run the bot (Giant/WB/Barb/Arch)
Code:
Switch $barrackTroop[$i]
Case 0
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 329, $BSpos[1] + 297), 6), Hex(0xDC3F70, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(220, 320) ;Barbarian
WEnd
Case 1
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(331, 320) ;Archer
WEnd
Case 2
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(432, 320) ;Giant
WEnd
Case 3
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(650, 320) ;WBs
WEnd
EndSwitch


Below is my current atkAlgorithmAllt() algorithm. I adjusted the drop order & rate to hopefully be more efficient (Giants > Barbs > WBs > Archers)

Code:
Func atkAlgorithmAllt() ;Attack Algorithm for Allt
While 1
Local $Giant = -1, $Wb = -1, $Barb = -1, $Arch = -1, $CC = -1
Global $King = -1, $Queen = -1
For $i = 0 To 6
If $atkTroops[$i][0] = "Giant" Then
$Giant = $i
ElseIf $atkTroops[$i][0] = "Wallbreaker" Then
$Wb = $i
ElseIf $atkTroops[$i][0] = "Barbarian" Then
$Barb = $i
ElseIf $atkTroops[$i][0] = "Archer" Then
$Arch = $i
ElseIf $atkTroops[$i][0] = "Clan Castle" Then
$CC = $i
ElseIf $atkTroops[$i][0] = "King" Then
$King = $i
ElseIf $atkTroops[$i][0] = "Queen" Then
$Queen = $i
EndIf
Next

If _Sleep(500) Then ExitLoop
Switch $deploySettings
Case 0 ;Two sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in two sides...")
If _Sleep(1000) Then ExitLoop
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 2) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 2) / 5) / 2)

SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

If _Sleep(2000) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

dropHeroes($TopLeft[3][0], $TopLeft[3][1], $King, $Queen)
If _Sleep(1000) Then ExitLoop
;If $CC <> -1 Then dropCC($TopLeft[3][0], $TopLeft[3][1], $CC)
Case 1 ;Three sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in three sides...")
If _Sleep(1000) Then ExitLoop
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 3) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 3) / 5) / 2)

SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

If _Sleep(2000) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

dropHeroes($TopRight[3][0], $TopRight[3][1], $King, $Queen)
If _Sleep(1000) Then ExitLoop
;If $CC <> -1 Then dropCC($TopRight[3][0], $TopRight[3][1], $CC)
Case 2 ;Four sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in all sides...")
If _Sleep(1000) Then ExitLoop
Local $numGiantPerSpot = Ceiling((($atkTroops[$Giant][1] / 4) / 5) / 2)
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 4) / 5) / 2)
Local $numWbPerSpot = Ceiling((($atkTroops[$Wb][1] / 4) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 4) / 5) / 2)

SetLog("Dropping first wave of Giants")
For $i = 0 To 4 ;Drop first round of Giants
Click(68 + (72 * $Giant), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numGiantPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numGiantPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numGiantPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numGiantPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Wallbreakers")
For $i = 0 To 4 ;Drop first round of Wallbreakers
Click(68 + (72 * $Wb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numWbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numWbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numWbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numWbPerSpot, 1)
Next

If _Sleep(200) Then ExitLoop

SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

If _Sleep(500) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(300) Then ExitLoop

SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

dropHeroes($BottomLeft[3][0], $BottomLeft[3][1], $King, $Queen)
If _Sleep(700) Then ExitLoop
;If $CC <> -1 Then dropCC($BottomLeft[3][0], $BottomLeft[3][1], $CC)
EndSwitch

If _Sleep(100) Then ExitLoop
SetLog("Dropping left over troops")
$atkTroops[$Barb][1] = Number(getNormal(40 + (72 * $Barb), 565))
$atkTroops[$Arch][1] = Number(getNormal(40 + (72 * $Arch), 565))

While $atkTroops[$Barb][1] <> 0
Click(68 + (72 * $Barb), 595)
Click($TopLeft[3][0], $TopLeft[3][1], $atkTroops[$Barb][1], 1)

$atkTroops[$Barb][1] = Number(getNormal(40 + (72 * $Barb), 565))
WEnd

If _Sleep(1000) Then ExitLoop

While $atkTroops[$Arch][1] <> 0
Click(68 + (72 * $Arch), 595)
Click($TopLeft[3][0], $TopLeft[3][1], $atkTroops[$Arch][1], 1)

$atkTroops[$Arch][1] = Number(getNormal(40 + (72 * $Arch), 565))
WEnd

If _Sleep(100) Then ExitLoop

;Activate KQ's power
If $checkKPower <> -1 Or $checkQPower <> -1 Then
SetLog("Waiting " & $delayActivateKQ / 1000 & " seconds before activating King/Queen")
_Sleep($delayActivateKQ)
If $checkKPower <> -1 Then
SetLog("Activate King's power")
Click(68 + (72 * $checkKPower), 595)
EndIf
If $checkQPower <> -1 Then
SetLog("Activate Queen's power")
Click(68 + (72 * $checkQPower), 595)
EndIf
EndIf

SetLog("~Finished Attacking, waiting to finish")
ExitLoop
WEnd
EndFunc   ;==>atkAlgorithmAllt
Reply
#13
compiled
Reply
 


Forum Jump:


Users browsing this thread: 1 Guest(s)

About The Bytecode Club

We're a community focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website