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 26, 2014#451

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 ?

@k3iroll try this too pls 🙂

one important thing is that you dont have selected your first barrack when you press the start button.
make sure u once clicked on the green grass to make sure you have nothing selected.

on slower machines it can happen that bluestacks isnt fast enough to load windows sometimes and the bot is spamming its clicks already 😉

-i added some more sleeps for slower machines
-the bot now clicks on the green before it clicks on a barack to make sure you dont have the first barrack selected when its starting.
-its showing important functions in the listbox so you always know in which function your bot is causing problems
-you can now chose between some more options, for example gold + dark
-i made the other options more understandable since the old one didnt seem to be clear for everyone 😉

http://pastebin.com/hagk9Fdv

if there is the demand for it i could add the option to manually set the sleeps in the actual GUI by replacing the sleep time by a variable.

let me know if it worked and if you liked it! merry xmas 🙂

Dec 26, 2014#452

@Antidote,GKevinOD

 Func OutofSync()
			
   			$OoSPixel1=PixelSearch(680,287,688,295,2631720,0,2,$HWnD)
			$OoSPixel2=PixelSearch(172,397,180,405,2631720,0,2,$HWnD)
			$OoSPixel3=PixelSearch(190,286,198,294,3388901,0,2,$HWnD)
		 If IsArray($OoSPixel1)+IsArray($OoSPixel2)+IsArray($OoSPixel3)=3 Then
			
			GUICtrlSetData($Results, "OutofSync! Searching Too Fast For Server!" & @CRLF, -1)
			ControlClick ($HWnD, "","", "left", "1", 59*$x_ratio, 433*$y_ratio)
			Start()
		 EndIf
EndFunc

Something like this to add at villagesearch() would resolve the out of sync. Although this works for me, it might not be accurate for others as it is again pixelsearch. GKevinOD is excellent at recoding.

Dec 26, 2014#453

@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.

I'm also new to Autoit. I'm not sure but just send him the rar files and run the exe. If it works then good, but if it doesn't then try asking Antidote or GKevinOD.

Dec 26, 2014#454

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.

This also happened to me and even boosted my barracks accidentally. I think the only problem to this is it's too fast. Try adding sleep(100) to this:

  Case $z = "Barbarian"
 For $i = 1 To 65 Step 1
 ControlClick ($HWnD, "","", "left", "1", 220*$x_ratio, 270*$y_ratio)
 If $RunState = False Then
   ExitLoop
 EndIf
 Sleep(50) ----> Change to 100 or 150.
 Next

Apply it to all other cases. Func TrainBarrack($x, $y, $z) Line 415 and below in ver003

Dec 26, 2014#455

you can simply compile the main script to an exe file.
it will include all includes into the exe. send him the exe file and tell him to put it in a folder.
config and Loots folder will be created automatically!

Dec 26, 2014#456

kojometa wrote:

ehsanslipknot wrote:

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 ?

@k3iroll try this too pls 🙂

one important thing is that you dont have selected your first barrack when you press the start button.
make sure u once clicked on the green grass to make sure you have nothing selected.

on slower machines it can happen that bluestacks isnt fast enough to load windows sometimes and the bot is spamming its clicks already 😉

-i added some more sleeps for slower machines
-the bot now clicks on the green before it clicks on a barack to make sure you dont have the first barrack selected when its starting.
-its showing important functions in the listbox so you always know in which function your bot is causing problems
-you can now chose between some more options, for example gold + dark
-i made the other options more understandable since the old one didnt seem to be clear for everyone 😉

http://pastebin.com/hagk9Fdv

if there is the demand for it i could add the option to manually set the sleeps in the actual GUI by replacing the sleep time by a variable.

let me know if it worked and if you liked it! merry xmas 🙂

Thanks kojometa. I tried the codes that you provided. The issue still persist for me.

There is no problem in locating the barracks. The bot did a very good job in locating the barracks.

The issue that I have is that when the bot started to spam its 65 clicks on the army, the army training window which is on top of the village is suddenly closed, hence, instead of clicking on the army (archer/barb), it is clicking on the village's wall ( or other structure which located on the same point as the archer/barbarian box).

Dec 26, 2014#457

yeah i understood your problem very well and the problem might have been solved with my script.
but now i got another idea.
pls try to put your barracks to a different place, delete your config.ini file and setup the bot again.
in some cases it can happen that there's something in front of the barrack like an elixir-collecting bubble causing the bot to clicking that bubble instead of the barrack.
tell me if changing locations of barracks worked for you

Dec 26, 2014#458

AtoZ wrote:

k3iroll wrote:

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.

This also happened to me and even boosted my barracks accidentally. I think the only problem to this is it's too fast. Try adding sleep(100) to this:

  Case $z = "Barbarian"
 For $i = 1 To 65 Step 1
 ControlClick ($HWnD, "","", "left", "1", 220*$x_ratio, 270*$y_ratio)
 If $RunState = False Then
   ExitLoop
 EndIf
 Sleep(50) ----> Change to 100 or 150.
 Next

Apply it to all other cases. Func TrainBarrack($x, $y, $z) Line 415 and below in ver003

Thansk AtoZ. Still does not solve my issue. The training clicking speed becoming slower, but still there is something that is closing the barrack army window during the 65 times clicking loop.

Dec 26, 2014#459

Finally! I found out the actual root cause for the problem that I'm having is due to the mouse pointer.

Placing the mouse pointer over the Bluestacks window during the operation of the bot is screwing up with the clicking.

Dec 26, 2014#460

thx for the share. i think a lot others could have that problem too 😉

This discussion is closed.