codebroken / BrokenBot

Best Free Clash of Clans Bot - Brokenbot
https://brokenbot.org
GNU General Public License v3.0
73 stars 58 forks source link

We appear to be stuck. Resetting troop counts. #35

Open mitfry opened 9 years ago

mitfry commented 9 years ago

After around 5 minutes of waiting for training troops to complete, BrokenBot suddenly decides to reset troop counts. After the reset is done, BrokenBot starts searching for a match while barely ANY troops are ready.

Below is a part of the log. At first you can see all is fine until 23:50:59 when it suddenly gets stuck. After that the bot loses count and becomes unusable. The only solution is to turn it off.


[23:49:08] Donating Troops
[23:49:11] No Archers available for donation.
[23:49:14] No Archers available for donation.
[23:49:17] Finished Donating
[23:49:17] Time Idle: 0 hours 3 minutes 0 seconds
[23:49:47] Checking Army Camp...
[23:49:52] Total Troop Capacity: 1/200
[23:49:52] - Giants 12
[23:49:53] Training Troops...
[23:49:56] ====== Barrack 1 : ======
[23:49:59] Total Troops building : 200
[23:50:03] ====== Barrack 2 : ======
[23:50:06] Total Troops building : 200
[23:50:10] ====== Barrack 3 : ======
[23:50:12] Total Troops building : 200
[23:50:17] ====== Barrack 4 : ======
[23:50:19] Total Troops building : 200
[23:50:20] Training Troops Complete...
[23:50:20] ~~~Waiting for full army~~~
[23:50:20] Donating Troops
[23:50:23] No Archers available for donation.
[23:50:25] No Archers available for donation.
[23:50:28] Finished Donating
[23:50:29] Time Idle: 0 hours 4 minutes 12 seconds
[23:50:59] We appear to be stuck. Resetting troop counts.
[23:50:59] Checking Army Camp...
[23:51:04] Total Troop Capacity: 1/200
[23:51:04] - Giants 12
[23:51:05] Training Troops...
[23:51:05] Forces needed: B-63, A-50, Go-13, Gi-0, W-8
[23:51:08] ====== Barrack 1 : ======
[23:51:14] Barrack 1 Training Wall Breaker : 2
[23:51:14] WallBreaker Remaining : 6
[23:51:14] Barrack 1 Training Goblin : 3
[23:51:14] Goblin Remaining : 10
[23:51:14] Barrack 1 Training Barbarian : 15
[23:51:14] Barbarian Remaining : 48
[23:51:14] Barrack 1 Training Archer : 12
[23:51:14] Archer Remaining : 38
[23:51:14] Total Troops building : 35
[23:51:19] ====== Barrack 2 : ======
[23:51:24] Barrack 2 Training Wall Breaker : 2
[23:51:24] WallBreaker Remaining : 4
[23:51:24] Barrack 2 Training Goblin : 3
[23:51:24] Goblin Remaining : 7
[23:51:24] Barrack 2 Training Barbarian : 15
[23:51:24] Barbarian Remaining : 33
[23:51:24] Barrack 2 Training Archer : 12
[23:51:24] Archer Remaining : 26
[23:51:24] Total Troops building : 69
codebroken commented 9 years ago

The bot can't read your troop counts for some reason. I have implemented temporary fix in 2.6.0

mitfry commented 9 years ago

I am using the latest version: v2.6.0. The issue still occurs in that build.

Is there anything I can do to help fixing this bug?

codebroken commented 9 years ago

On line 2 of cocbot\functions\strategies\standard\readycheck.au3 add the following line:

$stuckCount = 1

You will have to then right-click and recompile (x86) on brokenbot.au3 but that should hopefully help you until I can get a real fix done for you.

mitfry commented 9 years ago

Thanks. I'll report back in a couple of minutes.

mitfry commented 9 years ago

It seems to be running slightly better now. Still getting the same error but it keeps recalculating the required troops now. Good thing is that it doesnt start attacking before the troops are ready. Bad thing is that It removes troops before they are finished training and then adds them again. It gets the recalculating amounts right though but it adds the wrong amount and it keeps passing the max of 200 troops. It seems to be ignoring part of the troops that are already in the camps.

codebroken commented 9 years ago

Ok, so a better option for you to prevent that from happening...delete the $stuckCount = 1 and change it to $TimeSinceNewTroop = 0

mitfry commented 9 years ago

Changed the $stuckCount = 1 to $TimeSinceNewTroop = 0 as you said and so far so good. Been running for over 15 minutes now without seeing the error. It also hasn't unnecessarily removed and added troops. It now only prints the line "Forces needed" once every cycle altough it still adds the right troops, even after coming back from an attack.

You might have yourself a possible workaround for now :)

On a sidenote: When deploying troops. It seems to ignore the settings to deploy near the red line and the settings to delay deploying to look more human like.

EDIT: After a full cycle of attacking -> retraining troops -> attacking -> retraining troops it unnecessarily removed and added troops once and has been passing 200/200 ever since again but only by a small amount like 202/200. What's odd is that it reports training 183 troops while it actually is training 202. That counting part going wrong might be the cause of this problem.

Anyway im off for tonight, will be back tomorrow. Hopefully i provided you with some usefull information.