The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

BUG: 5.3.1: Bot hang/ blank windows

Started by dinobot · Jan 4, 2015

72 replies951,380 views
Jan 5, 2015#31

If that's the case I think we can target the checknextbutton(). Actually it can be optimized like this:

While not detect out of sync or inactivity message
   If next button found exitloop
   If detect out of sync, click message, runBot
   If 1 minutes pass restart BS, runBot
Wend
Jan 5, 2015#32

@Antidote
Would be awesome if you could write that in "Autoit-Language". I'm gonna add this in my script and then I will check whether this solves the problem.

Jan 5, 2015#33

Also I think this 2 lines doesn't change anything, as it would return right in the previous screen, we can actually leave it and let it wait for 5 minutes before doing a complete restart

Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess("BlueStacks App Player")), "Frontend", "RunApp")
Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
Jan 5, 2015#34

@Cocsi: try this, replace Func GetResources() with this one. I haven't tested it yet

Func GetResources() ;Reads resources
	While 1
		Local $i = 0
		While getGold(51, 66) = "" And Not _Sleep(500); Loops until gold is readable
			If Not $RunState Then ExitLoop (2)
			$i += 1
			If $i >= 30 Then
				If checkNextButton() Then 
					Click(750, 500)
					$i = 0
				EndIf
				If $i >= 120 Then
					SetLog("Cannot locate Next button, Restarting Bot")
					checkMainScreen()
					$Restart = True
					ExitLoop (2)
				EndIf
			EndIf
		WEnd
		If _Sleep(300) Or $RunState = False Then ExitLoop (2)

		$searchGold = getGold(51, 66)
		$searchElixir = getElixir(51, 66 + 29)
		$searchTrophy = getTrophy(51, 66 + 90)

		If $searchTrophy <> "" Then
			$searchDark = getDarkElixir(51, 66 + 57)
		Else
			$searchDark = 0
			$searchTrophy = getTrophy(51, 66 + 60)
		EndIf

		SetLog("(" & $SearchCount + 1 & ") [G]: " & $searchGold & Tab($searchGold, 12) & "[E]: " & $searchElixir & Tab($searchElixir, 12) & "[D]: " & $searchDark & Tab($searchDark, 12) & "[T]: " & $searchTrophy)
		$SearchCount += 1 ; Counter for number of searches
		ExitLoop
	WEnd
EndFunc   ;==>GetResources
Jan 5, 2015#35

@Antidote, cool will try it. 🙂

Just asking, are these fixes are also included in the released files?

Jan 5, 2015#36

@Antidote, cool will try it. 🙂

Just asking, are these fixes are also included in the released files?

Once the fix is done, we will be sure to release it.

Jan 5, 2015#37

@Antidote

Okay, I just compiled it. It is running now, looks a little bit "softer" while searching for a base, very excited to see if something changes 😉

I'll keep you updated

Jan 5, 2015#38

@Antidote

Update on the improvements. Your loop is causing that the bot doesn't detect the "Out of Sync error".

I think it is because you are looping until gold is unreadable, but if

Out of sync: Gold is not readable --> The func doesnt start --> stays at out of sync screen.

Maybe add another "and" after the while which concentrates on out of sync?

Jan 5, 2015#39

Hmm. That's strange, since I'm aware of checking for out of sync and if you notice, func _Sleep() is already used for out of sync and inactivity check. So when while loop pass through _Sleep(), it will check for out of sync and if found, it will stop there and calling main program again. Can you describe what happen when there is Out of Sync error? Maybe I should put some setlog in between to check for function flow.

Jan 5, 2015#40

last version,blank page after 2 hours

Got something to add?

Log in to post a reply.

Join the conversation