Jump to content

Script Pause for Func?


lopolop
 Share

Recommended Posts

i have a loop going that has a counter in it... when that reaches a certing amount then it runs a func(all in loop) does the script pause until the Function is complete? because the func takes a few seconds.

also it would be easier then having a counter but wasn't sure if i could use 2 loops in a script like just so every 10 minutes it runs the function while the other loop is still going

Link to comment
Share on other sites

Yes, the scripts waits till func is done, if you use it like this:

While 1
Sleep (100)
MySleep ()
WEnd

Func MySleep ()
ConsoleWrite ("Start"&@CR)
Sleep (1000 *5 )
ConsoleWrite ("Stop"&@CR)
EndFunc

What about using AdlibEnable() ???

You could replace loop with AdlibEnable ( "Task", 1000 ) to run Task once a second.

Link to comment
Share on other sites

Yes, the scripts waits till func is done, if you use it like this:

While 1
Sleep (100)
MySleep ()
WEnd

Func MySleep ()
ConsoleWrite ("Start"&@CR)
Sleep (1000 *5 )
ConsoleWrite ("Stop"&@CR)
EndFunc

What about using AdlibEnable() ???

You could replace loop with AdlibEnable ( "Task", 1000 ) to run Task once a second.

even with an adlib, the main thread of the script pauses during execution. If you really need the two threads to run concurrently, you should put the secondary function in a compile script of it's own, and call it as necessary with Run(), passing the function parameters as command line arguments.
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...