Sign in to follow this  
Followers 0
retghy

Pause execution of Script...

4 posts in this topic

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



#2 ·  Posted (edited)

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

#3 ·  Posted (edited)

Check out my post (#2) here. It should give you an idea of how to do it. Also, reference the HotkeySet() example in the help file.

edit - or you could check out CoPSX's post, too. :P

Edited by xcal

Share this post


Link to post
Share on other sites

Wow that was fast, thank you both for your replys. I'm gonna try it right away.

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