The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

Developing Bot

Started by Antidote · Dec 5, 2014

1,033 replies21,297,466 viewsLocked
Dec 25, 2014#441

There is a problem in 'out of sync' when attacking for bot ver003..

Dec 25, 2014#442


Quite cool all sides atk with increased drop speed.. Looks artificial though.. I think antidote or GkevinOD are already improving the attack. But for those who can't wait for the better codes.. I modded their code a bit so try using them atm:

Global $DropSpeed=4

Func DropTroop()
   While 1
  GUICtrlSetData($Results, "Start to drop troops" & @CRLF, -1)
  If $RunState = False Then
 ExitLoop
  EndIf
;---------------- ALL SIDES GIANT
  DropSingle("Giant",$UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
;----------------ALL SIDES GIANT DROP ROUND 2
  DropSingle("Giant",$UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Giant",$LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf

;---------------- ALL SIDES BARBS
  DropSingle("Barbarian", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
;---------------- ALL SIDES ARCHERS
  DropSingle("Archer", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  ;---------------- ALL SIDES BARBS Round 2
  DropSingle("Barbarian", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
;---------------- ALL SIDES ARCHERS Round 2
  DropSingle("Archer", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  ;---------------- ALL SIDES BARBS Round 3
  DropSingle("Barbarian", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Barbarian", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf
;---------------- ALL SIDES ARCHERS Round 3
  DropSingle("Archer", $UpLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $UpRight)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowLeft)
  If $RunState = False Then
 ExitLoop
  EndIf
  DropSingle("Archer", $LowRight)
  If $RunState = False Then
 ExitLoop
  EndIf

;----------------- END
  GUICtrlSetData($Results, "Finish dropping troops. Waiting for battle end." & @CRLF, -1)
  ExitLoop
   WEnd
EndFunc

Func DropSingle($T, $W)
   While 1
  If $RunState = False Then
 ExitLoop
  EndIf
  If CheckTroop($T) Then
 Select
 Case $T = "Giant"
 ControlClick ($HWnD, "","", "left", "1", $Giant[0], $Giant[1])
 Sleep(300/$DropSpeed)
; For $i = 0 to 4 Step 1
 For $i = 2 to 4 Step 2
   ControlClick ($HWnD, "","", "left", "1", $W[$i][0], $W[$i][1])
   Sleep(100/$DropSpeed)
 Next
 Sleep(3000/$DropSpeed)
 If $RunState = False Then
 ExitLoop
 EndIf
 Case $T = "Barbarian"
 ControlClick ($HWnD, "","", "left", "1", $Barbarian[0], $Barbarian[1])
 Sleep(300/$DropSpeed)
; For $x = 0 to 7 Step 1
 For $x = 0 to 3 Step 1 ; MADE IT HALF TO ACCOMODATE ALL SIDES
   For $i = 0 to 4 Step 1
  ControlClick ($HWnD, "","", "left", "1", $W[$i][0], $W[$i][1])
  Sleep(100/$DropSpeed)
   Next
 Next
 Sleep(1000/$DropSpeed)
 If $RunState = False Then
 ExitLoop
 EndIf
 Case $T = "Archer"
 ControlClick ($HWnD, "","", "left", "1", $Archer[0], $Archer[1])
 Sleep(300/$DropSpeed)
; For $x = 0 to 7 Step 1
 For $x = 0 to 3 Step 1 ; MADE IT HALF TO ACCOMODATE ALL SIDES
   For $i = 0 to 4 Step 1
  ControlClick ($HWnD, "","", "left", "1", $W[$i][0], $W[$i][1])
  Sleep(100/$DropSpeed)
   Next
 Next
 Sleep(1000/$DropSpeed)
 If $RunState = False Then
 ExitLoop
 EndIf
 Case $T = "Goblin"
 ControlClick ($HWnD, "","", "left", "1", $Goblin[0], $Goblin[1])
 Sleep(300/$DropSpeed)
; For $x = 0 to 7 Step 1
 For $x = 0 to 3 Step 1 ; MADE IT HALF TO ACCOMODATE ALL SIDES
   For $i = 0 to 4 Step 1
  ControlClick ($HWnD, "","", "left", "1", $W[$i][0], $W[$i][1])
  Sleep(100/$DropSpeed)
   Next
 Next
 Sleep(300/$DropSpeed)
 EndSelect
  EndIf
  ExitLoop
   WEnd
EndFunc

Replace the 2 functions above and don't forget to add the declaration. I only tried barchers with this one.. Enjoy!

Dec 25, 2014#443

Heey people where can i download THE bot? So i can help develop

Kind regards and merry christmass!!!!

Dec 25, 2014#444

I have a 4 day weekend.. going to play around with image search and try and add in a TH sniper mode..

basicly, search bottom right corner area for TH, if not search next corner/ ect, find one drop 5 archers at that corner.

No Idea how fast image search is, last time I ever did it was years ago on a diff system, was slow then, if its fast enough now, we could search for half full+ collectors around the edges of a base and drop troops close to them instead of just around the base hoping its near the collectors.

I think the bot has reached a point where we need more then one thread for it?

Does anyone run a forum or we could start a free proboards one for it..

I think it would help,
We could have a board for dev's to post updates/ideas/help each other, only devs posts allowed there.. they could deside when the next release is ready/ect.

Then another couple boards, like...
bugs board, for users to post bugs they find.
General board, for ideas/suggestions, and where the devs could post the newest script, with changelog/ect
also a working on list so the general user will know what the devs are working on for next release..

Ideas/ thoughts on something like this?

Dec 25, 2014#445

Make a separate topic on this forum only for this bot , i can help with develop , i can script aswell , let me know if i can help

Kind regards , and merry christmass

Dec 25, 2014#446

was doing great and i let it turned on,now i saw the bot gem boost barracks and stop training after 1 h

Dec 25, 2014#447

Hey guys
*Merry Xmas *
Thanks alot for this bot <3
But after im locate my barraks and click on train,just spam click on wall!
Anyone know why? And how can i fix it ?

Dec 26, 2014#448

Glad to see this project has gone very far! I expect it to get even bigger.

Dec 26, 2014#449

I still have issue during the training mode and I believe there are a few more people reported that the bot is clicking on the walls.

The observation that I have is that the bot locates all the 4 barracks successfully.

Below is the detail flow of the issue that I had during training:

1- Bot click barrack to open the barrack training window
2- Bot execute 65 consecutive rapid clicking to train barb/archer
3- Suddenly the barrack training window is closed and bot is still clicking to finish the loop of the 65 times
4- Because the training windows is no longer there, the bot is not clicking on archer/barb, instead the click hits the village structure e.g. wall.
5- The bot finished the 65 clicks
6- Continue to next barracks for training

Some time the bot managed to train all 4 barracks flawlessly without the above incidents.
Some other time, the bot managed to train one or two barracks only without the above incidents.

The reason that I can think of probably because there is another click outside the barrack training window that caused the window to be closed while the bot is performing its 65 consecutive clicks.

Dec 26, 2014#450

@AtoZ
How would I go about converting the two scripts into one exe? I have a friend whom I would like to send the bot to but I'm sure he would be too lazy to install autoit.

This discussion is closed.