codeslinger69 / clashbot Goto Github PK
View Code? Open in Web Editor NEWClash of Clans Farm Bot
Clash of Clans Farm Bot
The bot currently takes over the computer it is running on, as it clicks on various elements of the playing field and operates the game.
ClashGameBot has a nice approach to minimize this problem, using ControlClick with x, y parameters. This should be fairly easy to incorporate into my bot. Only thing to check is if the 0,0 offset with ControlClick is the same as the client area's 0,0 offset, since everything my bot does is keyed to the client 0,0 location.
Will test it out and incorporate if feasible. Click speed might be a problem for troop deployment, as I have a custom function based on a direct call to the windows api mouse event in order to bypass the built-in autoit delays. I believe that all other clicking can use the ControlClick approach, however.
As discussed in the "Open Discussion" thread, sometimes the bot won't pop a certain loot bubble or two. I've reproduced this and will investigate.
This is another discussion thread not an issue!
The topic is programming as it specifically relates to computer vision, how they see things and how to write code to make them recognize what you want.
I want to learn how to use them and find out if they will fit my purpose without modification. I have been modifying quite a lot of things, mainly because I don't know how you intended them. Often I find out, after many revisions, that the original did what I needed, it was me that needed to change.
Here is your code.
; Text boxes - left, top, right, bottom, Text Color - center, radius,
; Present indicator x, y, color, radius
Global $rGoldTextBox[10] = [42, 57, 120, 74, 0xfffbcc, 9, 30, 66, 0xeace3f, 6]
left, top, right, bottom = screen coordinates of bounding rectangle.
Text Color at center and radius from center are self exploratory.
What is the Present indicator x,y and additional color and radius?
"0" - is the character '0'
7 - is the quantity of numbers
... - The numbers but I don't know what they mean. They aren't in pairs so they aren't x,y cordinates as origianly suspected.
Here is your code.
; Army Camp Troop Counts
Global $gArmyCampCharMapsMaxWidth = 8
Global $gArmyCampCharacterMaps[10][$gArmyCampCharMapsMaxWidth+2] = [ _
["0", 7, 126, 127, 65, 65, 65, 127, 62], _
(... more info not included)
["9", 6, 112, 241, 137, 154, 254, 60] ]
OS: Windows 10, native (no VM); BlueStacks v0.10
Not (yet) sure about exactly how to reproduce this problem. Will add in details if I am able to figure this out.
Problem occurs in background mode, with auto-raid
and collect loot
set to true, dump cups
> 1400, barcher
strategy, gold
>=100000, elixir
>=60000, de>=0.
If it is of significance, the bluestacks window and the AutoIt window were in the foreground (even though the bot was set to background mode), and the monitor was off.
The log is as follows:
13-Feb-16 02:54:11 FillBarracksWithTroops() Adding 39 Barbarian
13-Feb-16 02:54:14 FillBarracksWithTroops() Barracks queue status: Traintroops39/40
13-Feb-16 02:54:14 FillBarracksWithTroops() Adding 1 Barbarian
13-Feb-16 02:54:17 FillBarracksWithTroops() Barracks queue status: Traintroops40/40
13-Feb-16 02:54:17 CloseArmyManagerWindow()
13-Feb-16 02:54:23 Auto Begin: Gold:408396 Elix:572622 Dark:3782 Cups:1294
13-Feb-16 02:57:18 AutoQueueTroops()
13-Feb-16 02:57:18 OpenArmyManagerWindow()
13-Feb-16 02:57:23 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 02:57:23 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:00:25 AutoQueueTroops()
13-Feb-16 03:00:25 OpenArmyManagerWindow()
13-Feb-16 03:00:30 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:00:30 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:03:35 AutoQueueTroops()
13-Feb-16 03:03:35 OpenArmyManagerWindow()
13-Feb-16 03:03:40 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:03:40 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:06:41 AutoQueueTroops()
13-Feb-16 03:06:41 OpenArmyManagerWindow()
13-Feb-16 03:06:46 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:06:46 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:09:48 AutoQueueTroops()
13-Feb-16 03:09:48 OpenArmyManagerWindow()
13-Feb-16 03:09:54 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:09:54 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:12:59 AutoQueueTroops()
13-Feb-16 03:12:59 OpenArmyManagerWindow()
13-Feb-16 03:13:05 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:13:05 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:16:06 AutoQueueTroops()
13-Feb-16 03:16:06 OpenArmyManagerWindow()
13-Feb-16 03:16:11 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:16:11 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:19:16 AutoQueueTroops()
13-Feb-16 03:19:16 OpenArmyManagerWindow()
13-Feb-16 03:19:21 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:19:21 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:22:26 AutoQueueTroops()
13-Feb-16 03:22:26 OpenArmyManagerWindow()
13-Feb-16 03:22:31 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:22:31 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:25:36 AutoQueueTroops()
13-Feb-16 03:25:36 OpenArmyManagerWindow()
13-Feb-16 03:25:41 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:25:41 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:28:42 AutoQueueTroops()
13-Feb-16 03:28:42 OpenArmyManagerWindow()
13-Feb-16 03:28:48 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:28:48 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:31:48 AutoQueueTroops()
13-Feb-16 03:31:48 OpenArmyManagerWindow()
13-Feb-16 03:31:54 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:31:54 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:34:55 AutoQueueTroops()
13-Feb-16 03:34:55 OpenArmyManagerWindow()
13-Feb-16 03:35:00 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:35:00 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:38:01 AutoQueueTroops()
13-Feb-16 03:38:01 OpenArmyManagerWindow()
13-Feb-16 03:38:07 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:38:07 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:41:08 AutoQueueTroops()
13-Feb-16 03:41:08 OpenArmyManagerWindow()
13-Feb-16 03:41:13 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:41:13 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:44:15 AutoQueueTroops()
13-Feb-16 03:44:15 OpenArmyManagerWindow()
13-Feb-16 03:44:20 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:44:20 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:47:22 AutoQueueTroops()
13-Feb-16 03:47:22 OpenArmyManagerWindow()
13-Feb-16 03:47:27 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:47:27 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:50:32 AutoQueueTroops()
13-Feb-16 03:50:32 OpenArmyManagerWindow()
13-Feb-16 03:50:37 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:50:37 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:53:38 AutoQueueTroops()
13-Feb-16 03:53:38 OpenArmyManagerWindow()
13-Feb-16 03:53:43 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:53:43 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:56:46 AutoQueueTroops()
13-Feb-16 03:56:46 OpenArmyManagerWindow()
13-Feb-16 03:56:52 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 03:56:52 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 03:59:53 AutoQueueTroops()
13-Feb-16 03:59:53 OpenArmyManagerWindow()
13-Feb-16 03:59:58 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
...
13-Feb-16 10:35:25 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 10:38:27 AutoQueueTroops()
13-Feb-16 10:38:27 OpenArmyManagerWindow()
13-Feb-16 10:38:32 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 10:38:32 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 10:40:19 ResetToCoCMainScreen() On Army Manager window - clicking close button
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 1 of 12 at 268,271
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 2 of 12 at 276,327
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 3 of 12 at 301,397
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 4 of 12 at 333,431
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 5 of 12 at 374,428
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 6 of 12 at 431,430
13-Feb-16 10:40:22 CollectLoot() Found collectors, clicking 7 of 12 at 414,364
13-Feb-16 10:40:23 CollectLoot() Found collectors, clicking 8 of 12 at 553,281
13-Feb-16 10:40:23 CollectLoot() Found collectors, clicking 9 of 12 at 569,306
13-Feb-16 10:40:23 CollectLoot() Found collectors, clicking 10 of 12 at 577,349
13-Feb-16 10:40:23 CollectLoot() Found collectors, clicking 11 of 12 at 463,178
13-Feb-16 10:40:23 CollectLoot() Found collectors, clicking 12 of 12 at 415,198
13-Feb-16 10:41:33 AutoQueueTroops()
13-Feb-16 10:41:33 OpenArmyManagerWindow()
13-Feb-16 10:41:38 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 10:41:38 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 10:44:42 AutoQueueTroops()
13-Feb-16 10:44:42 OpenArmyManagerWindow()
13-Feb-16 10:44:48 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 10:44:48 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 10:47:49 AutoQueueTroops()
13-Feb-16 10:47:49 OpenArmyManagerWindow()
13-Feb-16 10:47:54 OpenArmyManagerWindow() Failed - timeout opening Army Manager Window
13-Feb-16 10:47:54 AutoQueueTroops(): Not on army manager screen, resetting
13-Feb-16 10:49:32 CollectLoot() Found collectors, clicking 1 of 2 at 414,364
13-Feb-16 10:49:32 CollectLoot() Found collectors, clicking 2 of 2 at 553,281
13-Feb-16 10:50:55 AutoQueueTroops()
13-Feb-16 10:50:55 OpenArmyManagerWindow()
13-Feb-16 10:50:57 FillBarracksStrategy0() top up
13-Feb-16 10:50:58 Barracks 1 is showing full.
13-Feb-16 10:51:01 FillBarracksWithTroops() Barracks queue status: Traintroops42/55
13-Feb-16 10:51:01 FillBarracksWithTroops() Adding 13 Archer
13-Feb-16 10:51:03 FillBarracksWithTroops() Barracks queue status: Traintroops55/55
13-Feb-16 10:51:04 Barracks 2 is showing full.
13-Feb-16 10:51:07 FillBarracksWithTroops() Barracks queue status: Traintroops25/40
13-Feb-16 10:51:07 FillBarracksWithTroops() Adding 15 Barbarian
13-Feb-16 10:51:10 FillBarracksWithTroops() Barracks queue status: Traintroops40/40
13-Feb-16 10:51:11 Barracks 3 is showing full.
13-Feb-16 10:51:14 FillBarracksWithTroops() Barracks queue status: Traintroops27/40
13-Feb-16 10:51:14 FillBarracksWithTroops() Adding 13 Archer
13-Feb-16 10:51:17 FillBarracksWithTroops() Barracks queue status: Traintroops40/40
13-Feb-16 10:51:17 Barracks 4 is showing full.
13-Feb-16 10:51:20 FillBarracksWithTroops() Barracks queue status: Traintroops25/40
13-Feb-16 10:51:20 FillBarracksWithTroops() Adding 15 Barbarian
13-Feb-16 10:51:23 FillBarracksWithTroops() Barracks queue status: Traintroops25/40
13-Feb-16 10:51:23 FillBarracksWithTroops() Adding 15 Barbarian
13-Feb-16 10:51:26 FillBarracksWithTroops() Barracks queue status: Traintroops25/40
13-Feb-16 10:51:26 FillBarracksWithTroops() Adding 15 Barbarian
13-Feb-16 10:51:29 FillBarracksWithTroops() Barracks queue status: Traintroops40/40
13-Feb-16 10:51:29 Army Camps full.
13-Feb-16 10:51:29 CloseArmyManagerWindow()
13-Feb-16 10:51:30 AutoRaidFindMatch() Click Attack button
13-Feb-16 10:51:30 AutoRaidFindMatch() Click Find a Match button
13-Feb-16 10:51:38 AutoRaidGetDisplayedLoot() 63207 / 170849 / 278 / 14 / 8 / False
13-Feb-16 10:51:38 CheckForRaidableBase() No match (loot) gold=63207 elix=170849 dark=278
13-Feb-16 10:51:40 AutoRaidFindMatch() Click Next button
13-Feb-16 10:51:45 AutoRaidGetDisplayedLoot() 44990 / 83113 / 4 / 15 / 7 / False
I think it was on the Army Overview screen when I intervened manually, after which it ran fine, but I'm not very sure. I've set logging to verbose, and I'll post any updates I may have below.
Note to self, based on comment from dedren here: #22
Right now, a message is displayed if BlueStacks is the wrong size.
I am considering adding a few lines of code to automatically resize BlueStacks if needed. Pseudocode is:
Run('Regedit.exe /s "' & @ScriptDir & 'BlueStacks\1024x600.reg"')
** Thanks, ClashGameBot **Hello, testing your OCR lib with a string like "I Love This OCR" but the problem is always return result to ILoveThisOCR, (all space removed). I want that the result (text) will look like the original image. And the bigger problem is with 2 characters dont have space (zoomed in pixels) between them. How could i solve this. thanks for reading this.
Long time user of pokubot. Now switching to ClAsHbOt. Quite happy with it. I'm used to the disconnect detector. The ol' "you've been online too long and your troops need to rest". pokubot would automatically keep trying to sign you back on. Someone correct me if I've just missed a checkbox somewhere.
I have a strange issue since yesterday:
The bot keeps dumping cups even below the threshold:
8/26/2015 12:53:15 PM Dumping cups, current=934, threshold=1000
8/26/2015 12:53:15 PM FindAValidMatch()
8/26/2015 12:53:21 PM ControlClickDrag: handle: 00FE0432 380 80 383 379
8/26/2015 12:53:22 PM DeployTroopsToSides()
8/26/2015 12:53:25 PM Error getting end battle confirmation button.
8/26/2015 12:53:28 PM Dumping cups, current=934, threshold=1000
8/26/2015 12:53:28 PM FindAValidMatch()
8/26/2015 12:53:33 PM ControlClickDrag: handle: 00FE0432 500 75 451 398
8/26/2015 12:53:35 PM DeployTroopsToSides()
8/26/2015 12:53:41 PM Dumping cups, current=919, threshold=1000
8/26/2015 12:53:41 PM FindAValidMatch()
8/26/2015 12:53:46 PM ControlClickDrag: handle: 00FE0432 653 400 467 86
8/26/2015 12:53:47 PM DeployTroopsToSides()
8/26/2015 12:53:54 PM Dumping cups, current=903, threshold=1000
8/26/2015 12:53:54 PM FindAValidMatch()
8/26/2015 12:54:02 PM ControlClickDrag: handle: 00FE0432 554 83 522 385
8/26/2015 12:54:04 PM DeployTroopsToSides()
8/26/2015 12:54:10 PM Dumping cups, current=885, threshold=1000
8/26/2015 12:54:10 PM FindAValidMatch()
8/26/2015 12:54:19 PM ControlClickDrag: handle: 00FE0432 597 385 517 80
8/26/2015 12:54:20 PM DeployTroopsToSides()
8/26/2015 12:54:26 PM Dumping cups, current=870, threshold=1000
8/26/2015 12:54:26 PM FindAValidMatch()
New update affects the bot:
(2) Thoughts on the new Android bar overlaying the game:
An attack that deploys similar to the barch strategy. It would train 20-24 balloons, and rest minions. Then would pick the side based on certain buildings based off of the .bmp image created on each base that is checked for raid conditions.
I would gladly appreciate something like this and was told to open a new issue to discuss. I know this would take some of your time and I understand this. I would be more than willing to compensate you for your time and effort if you could make this possible.
when running in Vmare ,can not zoom automatic
but when I mannully zoom coc ,then it worked ,but when lost connection,robot fail and quit
robot can not last long like a whole day.
then
I insert
Send("{CTRLDOWN}")
MouseWheel("DWON",10)
MouseWheel("DWON",10)
MouseWheel("DWON",10)
MouseWheel("DWON",10)
MouseWheel("DWON",10)
Send("{CTRLUP}")
in
ZoomOut2 function in Screen.au3 ,it worked
but
sometimes it fail ,because I see some random click on map object below mouse
Hope fix in Vmare
Well, the July 1 update is upon us, and as expected, it broke a number of things. This issue thread will track the items that I need to fix.
Please add to this thread if you notice any other breaking changes.
Note to self.
Let me first start by saying that I wrote ClAsHbOt for myself, to scratch a personal itch. I put the code out here on github so anyone can use it if they want, but keep in mind, I am not "supporting" this bot per se. I'll try to help if I can, but a large part of the job of diagnosing problems and identifying root causes is on you. The main reason for this is that I don't have access to your computer, so I can't see what you see.
I don't want to put too fine a point on this, but the bot works great for me. I rely on this bot to farm a TH11 and a TH8 account for me, pretty much 24x7. If something breaks, I fix it quickly, as I want the bot to be operational. What this means is that you are doing something different than me, and since I did not design this bot for anyone but me, I'm sure there are configurations and scenarios out there that will cause problems. You need to help me understand what is different.
First thing to do
Search closed issues. We very well might have already discussed your problem and solved it. At the top of the issues list is a "Filter" button, and just to the right of that is a search box that work just like any other search box.
Here's some things you can do to begin diagnosing the problem
When it comes to asking for help on a problem, make sure to include any of the information below if it is relevant:
Requires a lot of image searching/matching. Will investigate if it can be done.
It would be great with a "Wait for Hero" check box.
So no attacks starts without atleast one Hero available.
/JoC
Code,
Is that me or the training time got longer - especially on the dark barracks.
The icon selection is taking quite long compare to previous releases.
So i did everything that the steps said, my resolution is fine aswell. But when I open the bot it shows on my taskbar but i cant see the window even if i try to maximise it.
I just tried Clashbot v20150623. The bot looks great, but I got the following error message boxes.
From looking at the code, when the BlueStacks resolution is wrong, FixBlueStacksSize() is called. This function then calls DebugWrite which causes the $gDebug error.
To resolve the problem I created $gDebug in Globals.au3.
Is there a reason this variable isn't already in Globals (with a default value of 0/false)?
6/16/2015 11:04:17 AM DonateTroops()
6/16/2015 11:04:18 AM Donate button found at absolute: 97, 152, 179, 177
6/16/2015 11:04:18 AM Donate text: 'wizards or archers plz'
6/16/2015 11:04:19 AM Donate troops window opened.
6/16/2015 11:04:19 AM Donate loop 1 of 5
6/16/2015 11:04:19 AM Troop DonateBarbarian.bmp found at 193, 76 conf: 99.92%
6/16/2015 11:04:19 AM Troop DonateArcher.bmp found at 263, 77 conf: 99.93%
6/16/2015 11:04:19 AM Troop DonateHogRider.bmp found at 470, 160 conf: 99.54%
6/16/2015 11:04:19 AM String match for: Wizard, troop NOT available, exiting.
It appears to only recognize one match, but then if troop is not available, it never moves to the 2nd match. It also seems to be confused by requests like "arch wiz min" where all 3 are available donations but it is unable to donate.
Detect troop requests, parse request text, and fill appropriately.
Note to self.
Considering adding a prominent checkbox on the GUI to enable/disable this.
Under the "very much not your problem" heading, recently seeing this error on a 2nd computer:
Line 496 (File "C:\Users\Coc\Desktop\ClAsHbOt-master\ClAsHbOt Script\Scraper.au3"):
Local $split = StringSplit($res[0], "|",2)
Local $split = StrongSplit($res^ERROR
Error: Subscript used on non-accessible variable
Having 0 experience with AutoIT, just hoping you might know how to trouble-shoot this and what I've done wrong.
Note to self.
I've been TH 10 for a few days now, and the standard barcher spam is not working so well for farming at this level. This is not wholly unexpected, but it does require some additional logic in the selection of bases to raid.
Dead bases can be chosen, but that does not entirely solve the problem either.
What is needed is to identify if the available loot is in storages and thus not likely reachable by barcher, rather than mostly in collectors, and thus available for easy farming.
Thus my next task is to work up some logic to detect the state of collectors, and have an option to only raid bases that have a significant amount of the available loot in the collectors.
I'm using Clashbot v20150623.
When doing Auto Raid, building troops works fine. The Attack button is clicked, but then the script hangs trying to locate the "Find a Match" button.
Attached is a screen shot of my Find a Match screen.
I see in RegionDefs.au3 where $rFindMatchScreenFindAMatchButton is looking for the button. Looking at my screen shot, it seems like my Find a Match button is lower than the coordinates Clashbot is looking for. I'm not sure why my screen would be different.
Here is my Clashbot log. I haven't had time yet, but I'll try changing the coordinates in RegionDefs to see if I can move forward. I have yet to get Clashbot to work, but love that it is open source AutoIt. Thanks for all your hard work.
===== Start of Log =====
6/25/2015 10:26:55 PM Keep Online clicked
6/25/2015 10:27:01 PM Collect Loot clicked
6/25/2015 10:27:09 PM CollectLoot()
6/25/2015 10:30:16 PM CollectLoot()
6/25/2015 10:33:10 PM Auto Raid clicked
6/25/2015 10:33:15 PM Auto Begin: Gold:2611357 Elix:5861960 Dark:8366 Cups:1590
6/25/2015 10:33:23 PM CollectLoot()
6/25/2015 10:33:26 PM AutoQueueTroops()
6/25/2015 10:33:27 PM OpenArmyCampWindow()
6/25/2015 10:33:28 PM Located Level 7 Army Camp at 296, 423 confidence 98.31%
6/25/2015 10:33:30 PM FindArmyCampTroopSlots()
6/25/2015 10:33:31 PM Troop Barbarian available: 49
6/25/2015 10:33:31 PM Troop Archer available: 55
6/25/2015 10:33:31 PM Troop Giant available: 4
6/25/2015 10:33:31 PM Troop Wall Breaker available: 4
6/25/2015 10:33:31 PM Troop Wizard available: 7
6/25/2015 10:33:36 PM OpenBarracksWindow()
6/25/2015 10:33:38 PM Barracks 0 found at 287,166 confidence 99.06%
6/25/2015 10:33:39 PM Train Troops button found at 362,7 confidence 99.92%
6/25/2015 10:33:42 PM FindSpellsQueueingWindow()
6/25/2015 10:33:58 PM Spells queued: 2 of 4
6/25/2015 10:33:59 PM FillBarracksStrategy0(), initial fill.
6/25/2015 10:34:02 PM FillBarracksWithTroops(), Adding 74 Archer
6/25/2015 10:34:11 PM FillBarracksWithTroops(), Adding 75 Barbarian
6/25/2015 10:34:20 PM FillBarracksWithTroops(), Adding 75 Archer
6/25/2015 10:34:28 PM FillBarracksWithTroops(), Adding 75 Barbarian
6/25/2015 10:34:33 PM CloseBarracksWindow()
6/25/2015 10:36:32 PM CollectLoot()
6/25/2015 10:37:38 PM AutoCheckIfTroopsReady()
6/25/2015 10:37:39 PM OpenArmyCampWindow()
6/25/2015 10:37:40 PM Located Level 7 Army Camp at 453, 53 confidence 96.26%
6/25/2015 10:37:42 PM FindArmyCampTroopSlots()
6/25/2015 10:37:42 PM Troop Barbarian available: 56
6/25/2015 10:37:43 PM Troop Archer available: 59
6/25/2015 10:37:43 PM Troop Giant available: 4
6/25/2015 10:37:43 PM Troop Wall Breaker available: 4
6/25/2015 10:37:43 PM Troop Wizard available: 7
6/25/2015 10:37:48 PM OpenBarracksWindow()
6/25/2015 10:37:50 PM Barracks 0 found at 287,166 confidence 99.05%
6/25/2015 10:37:51 PM Train Troops button found at 362,7 confidence 99.92%
6/25/2015 10:37:52 PM FindSpellsQueueingWindow()
6/25/2015 10:38:08 PM Spells queued: 4 of 4
6/25/2015 10:38:08 PM FillBarracksStrategy0(), top up.
6/25/2015 10:38:12 PM FillBarracksWithTroops(), Adding 3 Archer
6/25/2015 10:38:19 PM FillBarracksWithTroops(), Adding 2 Barbarian
6/25/2015 10:38:26 PM FillBarracksWithTroops(), Adding 2 Archer
6/25/2015 10:38:33 PM FillBarracksWithTroops(), Adding 2 Barbarian
6/25/2015 10:38:36 PM CloseBarracksWindow()
6/25/2015 10:38:42 PM FindAValidMatch()
6/25/2015 10:38:53 PM Find Match failed - timeout waiting for Find a Match button
6/25/2015 10:38:54 PM Auto: Error finding match, resetting.
6/25/2015 10:39:02 PM AutoQueueTroops()
6/25/2015 10:39:03 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:39:15 PM AutoQueueTroops()
6/25/2015 10:39:16 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:39:27 PM AutoQueueTroops()
6/25/2015 10:39:28 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:39:41 PM AutoQueueTroops()
6/25/2015 10:39:43 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:39:57 PM AutoQueueTroops()
6/25/2015 10:39:59 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:40:14 PM AutoQueueTroops()
6/25/2015 10:40:16 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:40:32 PM AutoQueueTroops()
6/25/2015 10:40:34 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:40:49 PM AutoQueueTroops()
6/25/2015 10:40:51 PM AutoQueueTroops(): Not on main screen, resetting.
6/25/2015 10:41:06 PM AutoQueueTroops()
6/25/2015 10:41:08 PM AutoQueueTroops(): Not on main screen, resetting.
===== End of Log =====
Hi,
I like the way this bot works but it would be a huge improvement to add detection for Dead bases by comparing the level of elixir in the collectors (like other bots do)
Is this possible?
Line 59 If $failCount <=0 Then
Error: Variable used without being declared
I checked keep online, collect loot, use breakers, and auto raid.
New feature in the Dec 10, 2015 client is the ability to donate dark spells. Will need to think through if it makes sense to support this, and how to do it in a rock solid manner.
My current efforts are to make the bot work in such a way as the bluestacks window can be obscured/minimized, and that you can continue to do other work on the computer without the mouse being stolen.
There are two parts to make this work:
Kind of stuck right now, but I am still hacking on this problem, as 1) I enjoy it 2) it bugs me and 3) I would like the bot to operate in this manner.
If anyone has any ideas on making ControlSend robust, please let me know. Really, the only thing I need it for is zooming out, so zoom out alternatives are appreciated as well.
Hi,
I'd like to know which type of combination is the most efficient for my Town hall level. For that I'd need to generate some stats. Would it be possible to create a CSV file with the information about all the attacks?
Something that would hold (1 line, 1 attack)
Time | Attack Strategy | Breakers | Gold >= | Elixir>= | Dark >= | TH <= | Dead Base? | Ignore Storages? | Cups | TH Level | Gold Loot | Elixir Loot | Dark Loot | Pre-training time |
---|
Pre-training time being the time between the end of the previous attack and the beginning of the new one.
Hey guys
Upgraded from windows 7 to 10 today. Blue stacks runs fine ..coc runs but when I run the bot it doesn't do anything in the game
I can't manage to get the Troops to be queued:
5/24/2015 11:45:48 PM Auto Snipe clicked
5/24/2015 11:45:52 PM AutoQueueTroops()
5/24/2015 11:45:52 PM OpenBarracksWindow()
5/24/2015 11:46:03 PM Auto Raid, Queue Troops failed - error finding available Barracks Button panel.
5/24/2015 11:46:13 PM AutoQueueTroops()
5/24/2015 11:46:13 PM OpenBarracksWindow()
5/24/2015 11:46:20 PM Auto Snipe clicked
5/24/2015 11:46:21 PM Auto Raid, Queue Troops failed - error finding available Barracks Button panel.
5/24/2015 11:48:09 PM Close clicked
5/24/2015 11:53:10 PM Char start/end 23/29 of 81
5/24/2015 11:53:10 PM Char start/end 32/38 of 81
5/24/2015 11:53:10 PM Char start/end 41/46 of 81
5/24/2015 11:53:10 PM Char start/end 53/57 of 81
5/24/2015 11:53:10 PM Char start/end 60/66 of 81
5/24/2015 11:53:10 PM Char start/end 70/76 of 81
5/24/2015 11:53:10 PM Char start/end -1/-1 of 81
5/24/2015 11:53:10 PM Char start/end 29/34 of 81
5/24/2015 11:53:10 PM Char start/end 37/43 of 81
5/24/2015 11:53:11 PM Char start/end 46/51 of 81
5/24/2015 11:53:11 PM Char start/end 59/59 of 81
5/24/2015 11:53:11 PM Char start/end 62/68 of 81
5/24/2015 11:53:11 PM Char start/end 72/78 of 81
5/24/2015 11:53:11 PM Char start/end -1/-1 of 81
5/24/2015 11:53:11 PM Char start/end 37/38 of 81
5/24/2015 11:53:11 PM Char start/end 41/48 of 81
5/24/2015 11:53:11 PM Char start/end 55/61 of 81
5/24/2015 11:53:11 PM Char start/end 64/71 of 81
5/24/2015 11:53:11 PM Char start/end 74/79 of 81
5/24/2015 11:53:11 PM Char start/end -1/-1 of 81
5/24/2015 11:53:11 PM Char start/end 36/40 of 59
5/24/2015 11:53:11 PM Char start/end 43/48 of 59
5/24/2015 11:53:11 PM Char start/end 51/56 of 59
5/24/2015 11:53:11 PM Char start/end -1/-1 of 59
5/24/2015 11:53:12 PM Char start/end 2/5 of 54
5/24/2015 11:53:12 PM Char start/end 7/14 of 54
5/24/2015 11:53:12 PM Char start/end 17/23 of 54
5/24/2015 11:53:12 PM Char start/end 26/33 of 54
5/24/2015 11:53:12 PM Char start/end -1/-1 of 54
5/24/2015 11:53:13 PM Auto Snipe clicked
5/24/2015 11:53:17 PM Char start/end 23/29 of 81
5/24/2015 11:53:17 PM Char start/end 32/38 of 81
5/24/2015 11:53:17 PM Char start/end 41/46 of 81
5/24/2015 11:53:17 PM Char start/end 53/57 of 81
5/24/2015 11:53:17 PM Char start/end 60/66 of 81
5/24/2015 11:53:17 PM Char start/end 70/76 of 81
5/24/2015 11:53:17 PM Char start/end -1/-1 of 81
5/24/2015 11:53:18 PM Char start/end 29/34 of 81
5/24/2015 11:53:18 PM Char start/end 37/43 of 81
5/24/2015 11:53:18 PM Char start/end 46/51 of 81
5/24/2015 11:53:18 PM Char start/end 59/59 of 81
5/24/2015 11:53:18 PM Char start/end 62/68 of 81
5/24/2015 11:53:18 PM Char start/end 72/78 of 81
5/24/2015 11:53:18 PM Char start/end -1/-1 of 81
5/24/2015 11:53:18 PM Char start/end 37/38 of 81
5/24/2015 11:53:18 PM Char start/end 41/48 of 81
5/24/2015 11:53:18 PM Char start/end 55/61 of 81
5/24/2015 11:53:18 PM Char start/end 64/71 of 81
5/24/2015 11:53:18 PM Char start/end 74/79 of 81
5/24/2015 11:53:18 PM Char start/end -1/-1 of 81
5/24/2015 11:53:19 PM Char start/end 36/40 of 59
5/24/2015 11:53:19 PM Char start/end 43/48 of 59
5/24/2015 11:53:19 PM Char start/end 51/56 of 59
5/24/2015 11:53:19 PM Char start/end -1/-1 of 59
5/24/2015 11:53:19 PM Char start/end 2/5 of 54
5/24/2015 11:53:19 PM Char start/end 7/14 of 54
5/24/2015 11:53:19 PM Char start/end 17/23 of 54
5/24/2015 11:53:20 PM Char start/end 26/33 of 54
5/24/2015 11:53:20 PM Char start/end -1/-1 of 54
5/24/2015 11:53:20 PM AutoQueueTroops()
5/24/2015 11:53:20 PM OpenBarracksWindow()
5/24/2015 11:53:32 PM Auto Raid, Queue Troops failed - error finding available Barracks Button panel.
5/24/2015 11:53:39 PM Char start/end 23/29 of 81
5/24/2015 11:53:39 PM Char start/end 32/38 of 81
5/24/2015 11:53:39 PM Char start/end 41/46 of 81
5/24/2015 11:53:39 PM Char start/end 53/57 of 81
5/24/2015 11:53:39 PM Char start/end 60/66 of 81
5/24/2015 11:53:39 PM Char start/end 70/76 of 81
5/24/2015 11:53:39 PM Char start/end -1/-1 of 81
5/24/2015 11:53:39 PM Char start/end 26/31 of 81
5/24/2015 11:53:39 PM Char start/end 34/40 of 81
5/24/2015 11:53:39 PM Char start/end 42/47 of 81
5/24/2015 11:53:39 PM Char start/end 54/59 of 81
5/24/2015 11:53:39 PM Char start/end 62/68 of 81
5/24/2015 11:53:39 PM Char start/end 71/78 of 81
5/24/2015 11:53:39 PM Char start/end -1/-1 of 81
5/24/2015 11:53:39 PM Char start/end 37/38 of 81
5/24/2015 11:53:39 PM Char start/end 41/48 of 81
5/24/2015 11:53:40 PM Char start/end 55/61 of 81
5/24/2015 11:53:40 PM Char start/end 64/71 of 81
5/24/2015 11:53:40 PM Char start/end 74/79 of 81
5/24/2015 11:53:40 PM Char start/end -1/-1 of 81
5/24/2015 11:53:40 PM Char start/end 36/40 of 59
5/24/2015 11:53:40 PM Char start/end 43/48 of 59
5/24/2015 11:53:40 PM Char start/end 51/56 of 59
5/24/2015 11:53:40 PM Char start/end -1/-1 of 59
5/24/2015 11:53:41 PM Char start/end 2/5 of 54
5/24/2015 11:53:41 PM Char start/end 7/14 of 54
5/24/2015 11:53:41 PM Char start/end 17/23 of 54
5/24/2015 11:53:41 PM Char start/end 26/33 of 54
5/24/2015 11:53:41 PM Char start/end -1/-1 of 54
5/24/2015 11:53:41 PM AutoQueueTroops()
5/24/2015 11:53:41 PM OpenBarracksWindow()
5/24/2015 11:53:50 PM Auto Raid, Queue Troops failed - error finding available Barracks Button panel.
5/24/2015 11:53:57 PM Char start/end 23/29 of 81
5/24/2015 11:53:57 PM Char start/end 32/38 of 81
5/24/2015 11:53:57 PM Char start/end 41/46 of 81
5/24/2015 11:53:57 PM Char start/end 53/57 of 81
5/24/2015 11:53:57 PM Char start/end 60/66 of 81
5/24/2015 11:53:57 PM Char start/end 70/76 of 81
5/24/2015 11:53:57 PM Char start/end -1/-1 of 81
5/24/2015 11:53:58 PM Char start/end 26/31 of 81
5/24/2015 11:53:58 PM Char start/end 34/40 of 81
5/24/2015 11:53:58 PM Char start/end 42/47 of 81
5/24/2015 11:53:58 PM Char start/end 54/59 of 81
5/24/2015 11:53:58 PM Char start/end 62/68 of 81
5/24/2015 11:53:58 PM Char start/end 71/78 of 81
5/24/2015 11:53:58 PM Char start/end -1/-1 of 81
5/24/2015 11:53:58 PM Char start/end 37/38 of 81
5/24/2015 11:53:58 PM Char start/end 41/48 of 81
5/24/2015 11:53:58 PM Char start/end 55/61 of 81
5/24/2015 11:53:58 PM Char start/end 64/71 of 81
5/24/2015 11:53:58 PM Char start/end 74/79 of 81
5/24/2015 11:53:58 PM Char start/end -1/-1 of 81
5/24/2015 11:53:58 PM Char start/end 36/40 of 59
5/24/2015 11:53:58 PM Char start/end 43/48 of 59
5/24/2015 11:53:58 PM Char start/end 51/56 of 59
5/24/2015 11:53:58 PM Char start/end -1/-1 of 59
5/24/2015 11:53:59 PM Char start/end 2/5 of 54
5/24/2015 11:53:59 PM Char start/end 7/14 of 54
5/24/2015 11:53:59 PM Char start/end 17/23 of 54
5/24/2015 11:53:59 PM Char start/end 26/33 of 54
5/24/2015 11:53:59 PM Char start/end -1/-1 of 54
5/24/2015 11:54:00 PM AutoQueueTroops()
5/24/2015 11:54:00 PM OpenBarracksWindow()
5/24/2015 11:54:04 PM Auto Snipe clicked
5/24/2015 11:54:08 PM Auto Raid, Queue Troops failed - error finding available Barracks Button panel.
Thanks!
Yup, this looks like a big update. TH11 and a bigger map.
You should all expect serious downtime on the bot, as this is likely going to take me a while to accommodate these changes into the code. I'll keep this thread updated as I make progress.
Since GitHub does not provide discussion forums, and since the ClAsHbOt code base is fairly stable now, I thought I would open this "Issue" as a general thread for any general discussion items. If you have a bug report or feature request, please open a separate issue. No other rules apply to this thread, and I'll keep it permanently open.
Idea from Cydin in open discussion thread:
"i think maybe u can make like gamebot they use timer that we can input, if no resource change between X seconds then end battle even the troops or BK/AQ not finished they attack"
Implementation will be as an option in the .ini file, to specify when an attack should be ended, after the available resource counters stop changing, regardless of troop/hero deployment status. If zero, then the standard logic will apply. Entry will default to zero for backwards compatibility reasons.
DO NOT TAKE OPTIONAL WINTER UPDATE
Folks, I am traveling on a family vacation and will not be working on the bot during this time. There is now an "Optional" winter update that among other things, allows you to disable the falling snow. However, it does add snow on the buildings.
Snow on the buildings will require me to capture new images for storages, collectors and town hall, at a minimum. I am loathe to do this at the best of times, but given that I just finished doing this for the Dec 10 update, I am really loathe to do it again, even if I was not traveling.
The bot appears to be working fairly well, and is even making loot for me on my TH10 account. Given the lack of problems at this time, I'll leave the code base alone for now, and look at it again when I get back. There are a few minor things left to do on the Dec 10 update, but nothing bot-killing.
New feature being considered.
The bot will detect "snipable" town halls right now, by looking for a town hall that is not in a central box in the approximate middle of the playing field.
Add an option to auto-snipe these town halls, as this would be useful for trophy pushing.
This would require a bit more safety in the detection of "snipable" town halls, so perhaps leverage some vector logic to see if there are any other buildings in between the town hall and the troop deployment area.
I'm running directly in Windows 7 (no VM) using BlueStacks 0.9.30.4239.
Note: I downloaded Clashbot from the main Clashbot screen by clicking Download ZIP (not by going through the Releases page).
Clashbot isn't able to open any windows. Below is the log and two screen shots it took.
Previous versions of Clashbot were able to get much further.
===Log===
7/23/2015 10:53:26 PM Collect Loot clicked
7/23/2015 10:53:29 PM Auto Raid clicked
7/23/2015 10:53:34 PM Auto Begin: Gold:549962 Elix:649507 Dark:77789 Cups:1179
7/23/2015 10:53:38 PM CollectLoot()
7/23/2015 10:53:40 PM AutoQueueTroops()
7/23/2015 10:53:40 PM OpenArmyManagerWindow()
7/23/2015 10:53:45 PM OpenArmyManagerWindow failed - timeout opening Army Manager Window.
7/23/2015 10:53:45 PM AutoQueueTroops(): Not on army manager screen, resetting.
7/23/2015 10:53:53 PM AutoQueueTroops()
7/23/2015 10:53:54 PM OpenArmyManagerWindow()
7/23/2015 10:53:58 PM OpenArmyManagerWindow failed - timeout opening Army Manager Window.
...
7/23/2015 10:55:38 PM Close clicked
===HomeScanFrame===
Removed
===CollectorsFrame===
Removed
Would it be possible to detect what level the majority of the walls have on a base?
So you can have an option: Attack base with majority of walls <= 9.
http://forum.supercell.net/showthread.php/844976-Update-17-09-Spell-revamp-War-tiebreaker
Need to check over everything to make sure it still works. Especially the colors/positions in the RegionDefs.au3 file.
New feature being considered.
Right now the bot deploys at random along the edges. This deployment is not just in the safe zone where buildings can't be placed, but into the playing field as well. Often, the bot will try to deploy inside a red zone, and you will see messages on the screen to this effect.
Add an algorithm to detect the red zone, and deploy around it, rather than in it, or randomly along the edge.
Hey I am finding that I can't stay online for longer then an hour...sometimes I am getting disconnected every few mins...logs say possible kick detection. Any ideas or ways to auto reconnect
BlueStacks 2.0 is currently not supported by ClAsHbOt due to the complexity of the multi tab interface.
However, there is a way to launch BlueStacks 2 without that clunky stuff, and just result in a clean window for the bot to work from.
Rumbla has been kind enough to point out some fixes:
This issue is a reminder to myself to investigate an easy-to-use way of doing this in the bot.
I'm running the current master of the repo (include the 15-odd commits), and I notice that ClAsHbOt keeps trying to deploy the barb king, even after he has successfully been deployed, causing the red error message "Please select another troop".
PS: I absolutely love ClAsHbOt!
Code,
Was trying to get the Zap DE functionality for my TH7 alternate account, I thought it would be a simple matter of editing the spell count and the for loop but I'm clearly misunderstanding how it works. It seems to recognize even unedited that I have 3/3 lightnings queued and/or ready, but then its not finding acceptable targets.
Just for my own curiosity, since it already seems to grab the correct quantity of spells (from the spell factory?), is there a way to edit those lines such that it will work regardless of TH level?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.