retghy Posted December 11, 2006 Posted December 11, 2006 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.
CoePSX Posted December 11, 2006 Posted December 11, 2006 (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 December 11, 2006 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]
xcal Posted December 11, 2006 Posted December 11, 2006 (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. Edited December 11, 2006 by xcal How To Ask Questions The Smart Way
retghy Posted December 11, 2006 Author Posted December 11, 2006 Wow that was fast, thank you both for your replys. I'm gonna try it right away.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now