Sign in to follow this  
Followers 0
shag

Exit Function not executing during while loop

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Alt is held the entire time, so escape never gets pressed.  Alt + escape does instead.

1 person likes this

Share this post


Link to post
Share on other sites

is there a way to send Alt + escape to exit the script?

or do I need to put a small break in there where th Alt key is not pressed?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HotKeySet("!{ESC}","Terminate")

I'm not at my computer but that should do the trick

Edited by TouchOdeath

Share this post


Link to post
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
Sign in to follow this  
Followers 0