Jump to content
Sign in to follow this  
pugboy

Sleeping withut Pausing

Recommended Posts

pugboy

I need to wait X milliseconds before preforming the next action, but the sleep command will interfere with my tray menu... None of the buttons do anything, and I am guessing because the script is "Paused" with the sleep function.

Is there a function for waiting X milliseconds, without pausing the script (so my tray menu items can do something)?

Share this post


Link to post
Share on other sites
Andreik

I need to wait X milliseconds before preforming the next action, but the sleep command will interfere with my tray menu... None of the buttons do anything, and I am guessing because the script is "Paused" with the sleep function.

Is there a function for waiting X milliseconds, without pausing the script (so my tray menu items can do something)?

Try with TimerInit() and TimerDiff().

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
pugboy

Doh! I forgot about the timer functions... Thanks!

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

I don't think timerinit and timerdiff can do the trick ..

timerinit is used to mark a time which can be used for counting

timerdiff is the difference between timerinit and calling timerdiff


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
pugboy

No, it worked.

Func wait($milliseconds)
    $begin = TimerInit()
    While 1
        checkTray()
        if(timerDiff($begin) >= $milliseconds) Then
            ExitLoop
        EndIf
    WEnd
EndFunc

The checkTray() is the routine checking if any buttons were pressed in the tray menu.

Share this post


Link to post
Share on other sites
AdmiralAlkex

Using _Timer_SetUp (I think that's it's name) might work better because than you wouldn't need to check in you main loop.

That should be _Timer_SetTimer()

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.