Jump to content

need help with pausescript


Recommended Posts

well i just made a little test scipt and it works, but when ive paused and unpaused it once, then it doesnt work anymore... why?

$pause=1

HotKeySet("{PAUSE}", "_pause")

Func _pause()
Select
    case $pause=1 
    pause()
    case $pause=2 
    unpause()
EndSelect
EndFunc


Func pause()
    $pause=$pause+1
    AdlibEnable("pause")
    sleep(300)
EndFunc

func unpause()
    $pause=$pause-1
    AdlibDisable()
EndFunc
Link to comment
Share on other sites

Try this:

$pause=0

HotKeySet("{ESC}", "quit")
HotKeySet("{PAUSE}", "pause")

While 1
    ConsoleWrite('running ...' & @CRLF)
    Sleep(1000)
WEnd


Func pause()
    $pause = Not $pause
    While $pause
        ConsoleWrite('paused ...' & @CRLF)
        Sleep(1000)
    WEnd
EndFunc

Func quit()
    Exit
EndFunc
Link to comment
Share on other sites

$pause=0

HotKeySet("{ESC}", "quit")
HotKeySet("{PAUSE}", "pause")

While 1
    ConsoleWrite('running ...' & @CRLF)
    Sleep(1000)
WEnd
Func pause()
    $pause = Not $pause
    While $pause
        ConsoleWrite('paused ...' & @CRLF)
        Sleep(1000)
    WEnd
EndFunc

Func quit()
    Exit
EndFunc
is this func able to pause Adlib too? or adlib is still working when the script is paused?
Link to comment
Share on other sites

Technicially you are not pausing the script, you are putting it in an idle loop which it does nothing(paused), and when you continue it goes back to your main loop and does your commands. You can only pause it if you use the default trayicon. Adlib will work throughout the entire script. Unless you use AdlibDisable()

Correct me if i am wrong.

Link to comment
Share on other sites

ok, so the only way is to disable and enable the adlib modding that code isnt it?

$pause=0

HotKeySet("{ESC}", "quit")
HotKeySet("{PAUSE}", "pause")

While 1
    ConsoleWrite('running ...' & @CRLF)
    Sleep(1000)
WEnd
Func pause()
    $pause = Not $pause
    While $pause
        AdlibDisable()
        ConsoleWrite('paused ...' & @CRLF)
        Sleep(1000)
    WEnd
    AdlibEnable("Func")
EndFunc

Func quit()
    Exit
EndFunc

is this correct?

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...