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 23, 2014#351

I just tried the bot now and my first search was just dropped 1 barb and then nothing... I returned home and bot start himself, checked the troops and then he start searching for enemy with succes just that i only had 3 giants and rest barbs and archs.
Keep it up!

Yes for a very small amount of search (2 or 3 for me after 6 hours run), it will fail to read gold and stuck in search check. I will look into it but I'll have to ask GkevinOD if he can figure that out, in the mean time I will add some check to bypass to the next village.

Dec 23, 2014#352

@Antidote I will work on making the search to have no idle time and fix the being stuck in search check.

Also for reading the troop amount, I will look into implementing that to the functions.

Dec 23, 2014#353

@GkevinOD: thanks mate 😉
I update checksearch to pass on to next village if it fails to read gold, so for now it can run error free until the 6 hour forced break (will fix that soon)

Func CheckSearch()
  Sleep(2000)
  $GoldCheck = ""
  $i = 0
  While $GoldCheck = ""
 $i += 1
 If $i > 75 And CheckScreenChange(0.25,0,0.75,0.25,1500) Then
ControlClick ($HWnD, "","", "left", "1", 715*$x_ratio, 405*$y_ratio) ;Click Next
$i = 0
 EndIf
 If $i > 150 Then
ControlClick ($HWnD, "","", "left", "1", 293*$x_ratio, 329*$y_ratio)
Sleep(6000)
Start()
$RunState = False
ExitLoop
 EndIf
     Local $countY = 0
 $GoldCheck = getGold($x_default, $y_default + $countY)
 While $GoldCheck = "" And $countY <= 4
  $countY += 1
  $GoldCheck = getGold($x_default, $y_default + $countY)
  WEnd
  Sleep(200)
  If $RunState = False Then
 ExitLoop
  EndIf
   WEnd
   ;GUICtrlSetData($Results, "Finish check" & @CRLF, -1)
EndFunc
Dec 23, 2014#354

I manage to fix it I believe. It will just skip the base if gold is not found. I will make it more efficient later, but this should also work:

Func CheckSearch()
	Sleep(2000)
    Local $countY = 0
	Local $countExit = 0
	$GoldCheck = getGold($x_default, $y_default + $countY)
	While $GoldCheck = ""
		If $countY >= 5 Then $countY = 0
		$countY += 1
		$countExit += 1
		$GoldCheck = getGold($x_default, $y_default + $countY)
		Sleep(200)
		If $countExit >= 50 Then 
			ControlClick ($HWnD, "","", "left", "1", 715*$x_ratio, 405*$y_ratio) ;Click Next
			$countExit = 0
		EndIf
		If $RunState = False Then
			ExitLoop
		EndIf
	WEnd
   ;GUICtrlSetData($Results, "Finish check" & @CRLF, -1)
EndFunc
Dec 23, 2014#355

why the bot is not skipping bases? no search

Dec 23, 2014#356

@Antidote I tested the zoom out function and it wasn't working for me. However, I manage to implement the _ColorVariation Function in GkevinOD.au3 to add some variation as the pixels may vary from computer to computer.

Func ZoomOut()
	GUICtrlSetData($Results, "Zoom Out" & @CRLF, -1)
	While 1
		$Pixel1 = _ColorCheckVariation(Hex(PixelGetColor(127, 248, $HWnD), 6), Hex(0xE8C656, 6), 20)
		$Pixel2 = _ColorCheckVariation(Hex(PixelGetColor(61, 298, $HWnD),6), Hex(0xAC8C42, 6), 20)
		$Pixel3 = _ColorCheckVariation(Hex(PixelGetColor(577, 130, $HWnD),6), Hex(0xD5A04F, 6), 20)
		$Pixel4 = _ColorCheckVariation(Hex(PixelGetColor(739, 251, $HWnD),6), Hex(0xECCE61, 6), 20)
		If $Pixel1 = True And $Pixel2 = True And $Pixel3 = True And $Pixel4 = True Then
			ExitLoop
		Else
			ControlSend($HWnD, "", "", "{DOWN}", 0)
		EndIf
		If $RunState = False Then
			ExitLoop
		EndIf
		Sleep(500)
	WEnd
	GUICtrlSetData($Results, "Zoom Out Complete" & @CRLF, -1)
EndFunc
Dec 23, 2014#357

@mikypark Can you list the steps that the bot takes?

For Example:

  1. Start bot
  2. Zoom Out
  3. Train Troops
  4. Start Search

Also tell us what code you added or used so we can specifically tell what the problem may be.

Dec 23, 2014#358

There's so many changes and updates! This is amazing hah. Hard to keep up. Anyone have the most up to date changes ?

Dec 23, 2014#360

@mikypark Can you list the steps that the bot takes?

For Example:

  1. Start bot
  2. Zoom Out
  3. Train Troops
  4. Start Search

Also tell us what code you added or used so we can specifically tell what the problem may be.

Ok so,since my english is not good,i made a screenshot for explain my problems,hope you can help me,thank you and keep it up.

Sometimes it just doesn't search opponents,sometimes skip forever,last time i saw 270000 gold 100k elisir and the bot just skipped.

Im using the last version of the bot.

This discussion is closed.