let me try to explain for you Envyus,
when bot zoom out, x axis is absolute. but y axis, have a little pixels passing of screen, so u need to fix your camera after zoomout, or UP or DOWN.
this work for me. no more miss clicks after it.
Developing Bot
Started by Antidote · Dec 5, 2014
Oh I see. So basically once it has zoomed out hold one of the arrow keys until it finds the barracks? Thank you for your help.
I am trying to run all of the latest files but have encountered an issue. I manually detect my barracks as I am requested to do so by the bot. It saves the location of all of them but then when it attempts to train my troops in constantly clicks on my DE storage and one of my DE drills. Both are not located near my barracks.
I am boosting my barracks if this has something to do with it?
delete the config file in your bot-folder and try again!
for absolute work, delete your config.ini of folder and start bot again, with one of sides of Y axis selected, or up or down. and always after zoomout, (first time you open the game) u put at same place (up or down)
I wasn't aware that there's a small variation in y axis, but it shouldn't matter anway, since the margin for x and y of barrack is quite large, 1 or 2 pixels off shouldn't affect bot clicking. Can you delete configs.ini file and make sure your resolution is 860x720 and try again?
I originally wrote it to account for resolution as well (using $x_ratio & $y_ratio) but some function (especially GkevinOD's) are very pixel sensitive, so 1 pixel off would make it unusable. If you noticed the bot can still click on basic button on 800x600 but you need 860x720 to run properly.
I've included the reg file to change to 860x720. Just run it and restart BlueStacks (right click on BS's icon in taskbar and click Restart)
http://www23.zippyshare.com/v/59243704/file.html
for now I haven't been able to read army troops so what the drop troop function does is very simple:
if giant selected, drop 5 giants on the left, wait 3 seconds
if barbarian selected, drop 40 barbarian on the left, wait 1 seconds
if archer selected, drop 40 archer on the left, wait 1 seconds
do the same for the right
drop 40 barbarian & 40 archer on the left in case there are still troops remaining (I haven't added goblin since I was only testing for bar and arch when I wrote it)
I can add dark troops as well, but it all relies on your selection. I have to work on imagesearch before I can determine exact troops composition in army camp.
@GkevinOD: Any chance you will work on reading troops number on attack panel? It would help to optimize attacking a lot since I can calculate exact amount to drop for each wave
@fly3r01: thanks a lot mate, this is very valuable information as I cannot replicate this enough to account for all events. If possible can you provide me some screenshots as well? I will look at program flow again and add neccessary check
yes it will click on break shield every time it start attack whether you have shield or not (since it's just clicking on blank screen otherwise and prevent unnecessary check lol)
Also loot depend a lot on trophy and time as well. There are days when loots are abundant in certain trophy range (I'm also mid TH8 and getting good loot in 1400~1500) but also at times there are little. If you experience many loss, you can try different troop composition or lower trophy range. Also can you guy suggest good attack settings? Like drop what troop first, how many troops, wait for how long, ... that would help me optimize attack further
I'm running the bot on another machine with my second account and notice there are 1 or 2 times when it stuck at attack screen (not able to read gold value thus fail the search check). May be for certain numbers pixel can be slightly off. Anyone having this issue?
I have tried everything including deleting the config file and zooming out and using the arrow keys and it does nothing but select my DE storage which is in the middle of my base lol.
Did it output your barrack's position in the box? And did it clicking on different places your just at the middle of your screen?
@Antidote,
-
There slightly variable mis-spell in line 54
"$Goblin" instead of "$Golbin". -
For zoom-out, you can try pixcelgetcolor to get the color of the most outer of North, South, East and West point. Using AND to get few color of each pole.
-
I tried disable all the $B3Pos, $B4Pos, $Barrack03 and $Barrack04, the bug still occur. Hence, i tested the controlclick eventually i found the bug on "ControlClick ($HWnD, "","", "left", "1", 560*$x_ratio, 490*$y_ratio)" at line 361. It clicked somewhere else instead of the "Train troops" button. After I changed the 560*$x_ratio and 490*$y_ratio, things got back to normal. I believe this will solve Envyus issue which is similar to my.
@Envyus, For temporally solution, at line 361 change
ControlClick ($HWnD, "","", "left", "1", 560*$x_ratio, 490*$y_ratio)
to
ControlClick ($HWnD, "","", "left", "1", 526, 598)