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 22, 2014#201

@kojometa: just tested out your script. The count down timer is neat, actually I did the same with TimerInit and TimerDiff, but I agree with vanadium, letting the script sleep through the whole time is quite counter intuitive, just a temporary measure til we can find better solution. DropTroop is helpful for testing as well (small mistake at  Case $VSButton, GUICtrlSetData($DTButton,"Dropping Troops..."). About goblin or giants, I've tested with giants, bar, archer and it was able to drop giants, bar, archer in consecutive order. Haven't tested goblin though. Basically what func AssignTroop does is sorting troops arcording to combobox selection. For example, selection: Giant,Bar,Bar,Arch. Troop orders in attack panel will be: Bar, Arch, Giant.
@vanadium: seems like it's how lf does, but I find it unproductive as sometimes my troops finish clearing all defense and go for loot when it detects no gold change and just end battle. i think to detect when the Return Home screen appears would be best
@AtoZ: can you share how you detect maxed zoom out? it's quite an important check to ensure the rest of the script function.
I'm still testing on GkevinOD's script. I made a script to brute force the correct first pixels but it's quite tedious to test on elixir as I'm not sure which pixels he uses for each number (trying to replicate the hex in photoshop). But this is a good approach.

 Opt ('PixelCoordMode', 2)

Func ZoomOut()

   For $z = 1 To 20 Step 1

	  ControlSend($Title, "", "", "{DOWN}", 0)

	  $PixelZoom1 = PixelGetColor(	854, 10,$HWnD)
	  $PixelZoom2 = PixelGetColor(8,14,$HWnD)
	  $PixelZoom3 = PixelGetColor(551, 662,$HWnD)
	  If $PixelZoom1=2176264 Then
	  If $PixelZoom2=1649672 Then
	  IF $PixelZoom3=7770925 Then
			$z=20
	  EndIf
	  EndIf
  	  EndIf
	  Sleep(200)
   Next
EndFunc
Dec 22, 2014#202

i cannot install tesseract....how to do it...

Dec 22, 2014#203

I've managed to tweak GkevinOD's code a bit to get both gold & elixir reading. It's super fast (it was nexting faster than you can read). Should've added parameters to it but I was lazy and ended up making 2 separate au3 files for gold and elixir lol. Below is the link to Bot.au3, GkevinODGoldFunction.au3 and GkevinODElixirFunction.au3. Just download all 3 to the same folder, run Bot.au3 and test for yourself. And since gold reading is much reliable now, I followed vanadium and modified ReturnHome to monitor gold change. It seems to be working but I haven't tested thoroughly yet. Also added a little extra button Keep Alive to help you guy prevent from being disconnect (what it does is send Down keyboard every 10 seconds). Enjoy!

http://www37.zippyshare.com/v/24789377/file.html
http://www37.zippyshare.com/v/92125782/file.html
http://www37.zippyshare.com/v/90677559/file.html

how to install bot...im new...

Dec 22, 2014#204

Can anyone teach me how to install the script ;-;

Dec 22, 2014#205

Just tested the latest version. It works pretty damn well for the most part. Only issue I have is that if I use giants or goblins I get an error after it starts dropping troops. I'll try to reproduce it and post the error later. The gold and elixer values work pretty well to start with but as the bot goes on they seem to run into some issues. It seems to detect the values too soon, seemingly while the clouds are still in place and I start getting inaccurate values. The bot also fails to start when I active the Keep Alive button. I'm gonna mess with it a bit more tonight and I'll edit if I run into any more issues.

Dec 22, 2014#207

@xanthox yes download and put them all into the same folder however I seem to have run into some problems and I'll have to see if I can resolve them before I can help you further.

Dec 22, 2014#208

Thanks !

Dec 22, 2014#209

Hello everyone,
Once again I have modified my GetGold Function 2.0 and implemeted all 4 of the resources! Gold, Elixir, Dark Elixir, and Trophies aswell! Renamed as GetResources 3.0!
http://pastebin.com/iqtERQSr

I basically got the colors of every pixel of the same location once again and for each resources, they are slightly different. This function also does not even take a second to get ALL of the resources (~30 milliSeconds for me).
Also, I implemented Antidote's code to tell the time and fix the 1 pixel off position. Now, you may need to change the values for the 1 pixel off position as it varies from computer to computer and it is basically set to my preferences.
Very easy to implement and easy replacement for Tesseract! I will also be working on trying to get the resources of your village, located to the right of the window.
P.S. @Antidote : You can use this function it is more efficient and accurate, I believe 🙂

implemented it and tested it out. for me it has 100% accuracy so far 🙂
definetly better as the former one!
just tested gold and elixir though
thx

Dec 22, 2014#210

kojometa wrote:

GkevinOD wrote:

Hello everyone,
Once again I have modified my GetGold Function 2.0 and implemeted all 4 of the resources! Gold, Elixir, Dark Elixir, and Trophies aswell! Renamed as GetResources 3.0!
http://pastebin.com/iqtERQSr

I basically got the colors of every pixel of the same location once again and for each resources, they are slightly different. This function also does not even take a second to get ALL of the resources (~30 milliSeconds for me).
Also, I implemented Antidote's code to tell the time and fix the 1 pixel off position. Now, you may need to change the values for the 1 pixel off position as it varies from computer to computer and it is basically set to my preferences.
Very easy to implement and easy replacement for Tesseract! I will also be working on trying to get the resources of your village, located to the right of the window.
P.S. @Antidote : You can use this function it is more efficient and accurate, I believe 🙂

implemented it and tested it out. for me it has 100% accuracy so far 🙂
definetly better as the former one!
just tested gold and elixir though
thx

How to get it works. Thanks 🙂 I dont have <ScreenCapture.au3>

This discussion is closed.