Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func checkMainScreen() ;Checks if in main screen
- getBSPos()
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 284, $BSpos[1] + 28), 6), Hex(0x41B1CD, 6), 20) = False Then
- SetLog("Trying to get to main screen")
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 458, $BSpos[1] + 311), 6), Hex(0x33B5E5, 6), 20) Then ;Check for out of sync or inactivity
- Click(416, 399)
- Else
- WinActive("BlueStacks App Player")
- Click(126, 700)
- Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess("BlueStacks App Player")), "Frontend", "RunApp")
- Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
- EndIf
- If _Sleep(10000) or $RunState = False Then Return
- waitMainScreen()
- EndIf
- EndFunc
- Func waitMainScreen()
- Local $counter = 0
- While 1
- If WinExists("BlueStacks App Player") Then
- getBSPos()
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 235, $BSpos[1] + 209), 6), Hex(0x9E3826, 6), 20) Then Click(429, 493);See if village was attacked, clicks Okay
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 284, $BSpos[1] + 28), 6), Hex(0x215B69, 6), 20) Then Click(1, 1) ;Click away If things are open
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 819, $BSpos[1] + 55), 6), Hex(0xD80400, 6), 20) Then Click(819, 55) ;Clicks X
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 331, $BSpos[1] + 330), 6), Hex(0xF0A03B, 6), 20) Then Click(331, 330) ;Clicks chat thing
- If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 284, $BSpos[1] + 28), 6), Hex(0x41B1CD, 6), 20) Then ;In main screen
- Exitloop
- EndIf
- EndIf
- $counter += 1
- If $counter >= 150 Then ;Five minutes
- SetLog("Could not automatically load Clash Of Clans")
- If _Sleep(1000) or $RunState = False Then ExitLoop(2)
- SetLog("Restarting BlueStacks")
- WinActive("BlueStacks App Player")
- Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess("BlueStacks App Player")), "Frontend", "RunApp")
- ProcessClose("HD-Frontend.exe")
- If _Sleep(5000) or $RunState = False Then ExitLoop(2)
- Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
- Do
- If _Sleep(10000) or $RunState = False Then ExitLoop(2)
- Until ControlGetHandle("BlueStacks App Player", "", "BlueStacksApp1") <> 0
- checkMainScreen()
- ExitLoop
- EndIf
- If _Sleep(2000) or $RunState = False Then ExitLoop
- WEnd
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement