Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[BUG] 1 troop placed at right corner (mis-click)
#1
Settings:
- Dead base search (maybe all bases too, will double check)
- Background mode (could be the issue?). I saw that dinobot posted that dead base doesn't work with background mode, but is this the issue that occurs? My apologies if this is the case!

It skips through some bases trying to find a match, but after a few minutes, it does this.

Note: I've added the "use all troops" (modified version of barch) function & I use giants > barbs > archers. Usually it works fine, background mode or not.

It places 1 barb in the circled area below, then I get the message, repeatedly, that you cannot deploy troops on the red area. The log keeps repeating the resources available for the base, so I'm assuming it's stuck in the main "while" loop of the GetResources() function.

[Image: 21lv1n6.jpg]

I've seen this happen 2-3 times. I don't know what it's trying to click - no buttons near the right corner, except the right arrow when training troops, but that's not used by the bot, correct?
Reply
#2
Reply
#3
(01-15-2015, 03:26 AM)barracoda Wrote:  Settings:
- Dead base search (maybe all bases too, will double check)
- Background mode (could be the issue?). I saw that dinobot posted that dead base doesn't work with background mode, but is this the issue that occurs? My apologies if this is the case!

It skips through some bases trying to find a match, but after a few minutes, it does this.

Note: I've added the "use all troops" (modified version of barch) function & I use giants > barbs > archers. Usually it works fine, background mode or not.

It places 1 barb in the circled area below, then I get the message, repeatedly, that you cannot deploy troops on the red area. The log keeps repeating the resources available for the base, so I'm assuming it's stuck in the main "while" loop of the GetResources() function.

[Image: 21lv1n6.jpg]

I've seen this happen 2-3 times. I don't know what it's trying to click - no buttons near the right corner, except the right arrow when training troops, but that's not used by the bot, correct?

Does this happen without the modified one? Whats the modification..more info regarding this please.
Be Wise & Good As Much As You Could
-Mystery7 Shadetongue
Reply
#4
Yes, this was with the modified one - not sure if it happened before or not.
I basically just copied & pasted the barch algorithm, and added giants above the barbs, and set sleep to 4000 before barbs get deployed. I also disabled CC troops from attacks (at least for 'Attack all sides' since that's what I use). I just use them for defense in the event I get kicked off. I also set the tolerance to 65 near the top of the script.

With that said, since I've unchecked Background mode (still attacking dead bases), I've not seen the issue resurface Smile
I'll give the cross build a try tonight.

Altered attack function:
Code:
Func Attack() ;Selects which algorithm
While 1
SetLog("======Beginning Attack======")
Switch $icmbAlgorithm
Case 0 ;Barbarians + Archers
atkAlgorithmBarch()
Case 1 ;Use All Troops
;SetLog("Not Available yet, using Barch instead...")
If _Sleep(2000) Then ExitLoop
;atkAlgorithmBarch()
atkAlgorithmAllt()
EndSwitch
ExitLoop
WEnd
EndFunc   ;==>Attack

The new function:
Code:
Func atkAlgorithmAllt() ;Attack Algorithm for Allt
While 1
Local $Giant = -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] = "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 $numGiantPerSpot = Ceiling((($atkTroops[$Giant][1] / 2) / 5) / 2)
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 2) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 2) / 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($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($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 Giants")
For $i = 0 To 4 ;Drop second 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($BottomRight[$i][0], $BottomRight[$i][1], $numGiantPerSpot, 1)
Next

If _Sleep(1000) 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 $numGiantPerSpot = Ceiling((($atkTroops[$Giant][1] / 3) / 5) / 2)
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 3) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 3) / 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($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($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 Giants")
For $i = 0 To 4 ;Drop second round of Giants
Click(68 + (72 * $Barb), 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($BottomRight[$i][0], $BottomRight[$i][1], $numGiantPerSpot, 1)
Next

If _Sleep(1000) 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 $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(3500) 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 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(1000) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Giants")
For $i = 0 To 4 ;Drop second round of Giants
Click(68 + (72 * $Giant), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numGiantPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numGiantPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numGiantPerSpot, 1)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numGiantPerSpot, 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($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 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(1000) 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[$Giant][1] = Number(getNormal(40 + (72 * $Giant), 565))
$atkTroops[$Barb][1] = Number(getNormal(40 + (72 * $Barb), 565))
$atkTroops[$Arch][1] = Number(getNormal(40 + (72 * $Arch), 565))

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

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

If _Sleep(1000) Then ExitLoop

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
 


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