Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[BUG] 1 troop placed at right corner (mis-click)
#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
 


Messages In This Thread
RE: [BUG] 1 troop placed at right corner (mis-click) - by barracoda - 01-15-2015, 10:45 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)

About The Bytecode Club

We're a community forum 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