Thread Rating:
  • 7 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Developing Bot
I'm still learning everything from scratch like many of you guys here (luckily Autoit has very smooth learning curve), so mistakes are here and there and I'm constantly updating the code if I find better ways to do it. Anw since many people contribute now, is there anyway we can effectively collaborate without having to copy paste every time? Something like Github or Google Code?
Good job Antidote for your work. I just tried your last bot and at the beginning it just trains the troops and then after it starts searching for a battle but without troops in the camps. Good luck again
I edited some stuff.
Most significant is the ReturnHome function.
I added a timer wich will run 150 Seconds (you can see the actual countdown in the GUI) and then return home.
Also it is always showing which function is called at the moment to recognise where potential errors are happening.

what i found out: if you pick goblins or giants in the comboboxes, it closes the script after developing because it seems to crash in AssignTroop.

http://pastebin.com/FTsnMPbT

Wink
Rather detect gold and elixir change.
It's not sufficient to detect When Home button appears: all troops and spells may not have been used for the battle. In this case, return home appears only after 3min timeout. Also, depending you get at least one star or not, the button is either "Surrender" or "End battle", with a prompt in the first case.

The best solution is to check gold + elixir change, and stop the battle after 30sec without changes. It works perfectly fine for me. It does not take that much cpu.

On my bot done in Java, i have a JSON config for:
- the army to train,
- the troops to deploy, in which order, how many, when to enable hero ability etc.

Sample army config:
Quote:{
"BARBARIAN": "108",
"ARCHER": "107"
}

Sample deploy config:
Quote:[
{
"@type": "ScootCorners",
"troop": "BARBARIAN"
},
{
"@type": "HoldOn",
"duration": "10",
"unit": "SECONDS"
},
{
"@type": "SendTroopCount",
"troop": "BARBARIAN",
"count": "30",
"distribution": "RANDOM"
},
{
"@type": "SendTroopCount",
"troop": "ARCHER",
"count": "30",
"distribution": "RANDOM"
},
{
"@type": "HoldOn",
"duration": "2",
"unit": "SECONDS"
},
...
]

It's very convenient to change the trained army, troop deployment because it does not require to change the code. But, hey, it's a hell easier in Java.
Make sense to me now since I tend to always use up all troops in battle I might overlook that. By detecting gold & elixir change, do you detect change in that screen region (pixelchecksum) or actually read gold & elixir to compare? How would it handle when you get 3 stars or battle end early (out of troops)?
Also I believe config file can be done in Autoit as well, requires very organized and flexible coding though. From what I see, your bot seems way ahead :D
 


Forum Jump:


Users browsing this thread: 43 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