Jump to content

Exit Function not executing during while loop


shag
 Share

Recommended Posts

Hello I'm trying to use the exit and pause function, but I can't get it to work. Can you please look at my code and see what is wrong?

Thank you

 

HotKeySet("{p}","TogglePause")
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

While 1
    Send("{ALT DOWN}")
    Sleep(200)

    $load = 0

      While ($load = 0)
      $load = _ImageSearchArea("Ore.BMP",1,$centre_x-100,$centre_y-100,$centre_x+100,$centre_y+100,$site_x,$site_y,80)
      WEnd

    MouseMove($site_x,$site_y)
    Sleep(200)
    MouseClick("left",$site_x,$site_y,3,0)
    MouseMove($centre_x,$centre_y-250)
    MouseClick("left",$centre_x,$centre_y-250,3,0)
    Sleep(200)
    Send("{ALT UP}")
WEnd

Func TogglePause()
    $paused = NOT $paused
    While $paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    Sleep(2000)
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

 

Edited by shag
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...