Jump to content
Sign in to follow this  
retghy

Pause execution of Script...

Recommended Posts

Hello all, I have this simple code that clicks certain spots in screen with a loop:

HotKeySet("+c", "enca")
HotKeySet("+p", "comprar")
HotKeySet("{Esc}","parar")
While 1
    Sleep(100)
WEnd

;Detiene el script
Func parar()
    Exit 0
EndFunc

Func enca()
    For $i=50 to 0 Step -1
    MouseClick("right",835,803,2,5)
    MouseClick("left",581,628,2,5)
    MouseClick("left",608,948,2,5)
    Next
EndFunc

Func comprar()
    For $i=50 to 0 Step -1
    MouseClick("left")
    Next
EndFunc

What I want to know is how to pause script execution and not actually exiting just pause with a hotkey for example.

As you may see i found the "exit 0" but when I do that i need to run the scrpit again to continue.

any help would be apreciated, thanks in advance.

Share this post


Link to post
Share on other sites

Global $IsPaused = False

HotKeySet("+c", "enca")
HotKeySet("+p", "comprar")
HotKeySet("{Esc}","parar")
While 1
    Sleep(100)
WEnd

;Detiene el script
Func parar()
    $IsPaused = True
EndFunc

Func enca()
    $IsPaused = False
    For $i=50 to 0 Step -1
        If ($IsPaused) Then Return
        MouseClick("right",835,803,2,5)
        MouseClick("left",581,628,2,5)
        MouseClick("left",608,948,2,5)
    Next
EndFunc

Func comprar()
    $IsPaused = False
    For $i=50 to 0 Step -1
        If ($IsPaused) Then Return
        MouseClick("left")
    Next
EndFunc

This will make the other functions stop when IsPaused is set to True.

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

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  

×
×
  • Create New...