Advertisement
GkevinOD

Hang Fix v5.3

Jan 5th, 2015
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.50 KB | None | 0 0
  1.    Func checkMainScreen() ;Checks if in main screen
  2.       getBSPos()
  3.       If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 284, $BSpos[1] + 28), 6), Hex(0x41B1CD, 6), 20) = False Then
  4.          SetLog("Trying to get to main screen")
  5.  
  6.          If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 458, $BSpos[1] + 311), 6), Hex(0x33B5E5, 6), 20) Then ;Check for out of sync or inactivity
  7.             Click(416, 399)
  8.          Else
  9.             WinActive("BlueStacks App Player")
  10.             Click(126, 700)
  11.  
  12.             Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess("BlueStacks App Player")), "Frontend", "RunApp")
  13.             Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
  14.          EndIf
  15.  
  16.          If _Sleep(10000) or $RunState = False Then Return
  17.          waitMainScreen()
  18.       EndIf
  19.    EndFunc
  20.  
  21.    Func waitMainScreen()
  22.       Local $counter = 0
  23.  
  24.       While 1
  25.          If WinExists("BlueStacks App Player") Then
  26.                   getBSPos()
  27.                   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
  28.  
  29.                   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
  30.  
  31.                   If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 819, $BSpos[1] + 55), 6), Hex(0xD80400, 6), 20) Then Click(819, 55) ;Clicks X
  32.  
  33.                   If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 331, $BSpos[1] + 330), 6), Hex(0xF0A03B, 6), 20) Then Click(331, 330) ;Clicks chat thing
  34.  
  35.                   If _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 284, $BSpos[1] + 28), 6), Hex(0x41B1CD, 6), 20) Then ;In main screen
  36.                Exitloop
  37.             EndIf
  38.          EndIf
  39.          $counter += 1
  40.  
  41.          If $counter >= 150 Then ;Five minutes
  42.             SetLog("Could not automatically load Clash Of Clans")
  43.             If _Sleep(1000) or $RunState = False Then ExitLoop(2)
  44.             SetLog("Restarting BlueStacks")
  45.             WinActive("BlueStacks App Player")
  46.  
  47.             Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess("BlueStacks App Player")), "Frontend", "RunApp")
  48.             ProcessClose("HD-Frontend.exe")
  49.             If _Sleep(5000) or $RunState = False Then ExitLoop(2)
  50.             Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
  51.  
  52.             Do
  53.                If _Sleep(10000) or $RunState = False Then ExitLoop(2)
  54.             Until ControlGetHandle("BlueStacks App Player", "", "BlueStacksApp1") <> 0
  55.  
  56.             checkMainScreen()
  57.             ExitLoop
  58.          EndIf
  59.  
  60.          If _Sleep(2000) or $RunState = False Then ExitLoop
  61.       WEnd
  62.    EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement