Jump to content

Queues and timers


Recommended Posts

Hey, I have searched these forums and the autoit help but have not been able to find what i need, so hopefully one of you will be able to help me.

My ultimate goal with the program is to have 3 functions that run lets say every 15,30,50 secs. (Func 1 being every 15 secs, Func2 ever 30, Func3 every 50)

My idea to do this was to have 3 timers that when finished would reset and push the func onto a queue, which the program would be continously watching. Except I can't find any timers other then _Timer_SetTimer which seems to require a GUI which I don't want. Is there another type of timer/clock something of the sort that is able to be run in the background.

Link to comment
Share on other sites

$timer = 0

While 1
    Sleep(1000)
    $timer += 1
    If Mod($timer, 15) = 0
        func1()
    EndIf
    If Mod($timer, 30) = 0
        func2()
    EndIf
    If Mod($timer, 50) = 0
        func3()
    EndIf
WEnd

Func func1()
EndFunc

Func func2()
EndFunc

Func func3()
EndFunc

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

My idea to do this was to have 3 timers that when finished would reset and push the func onto a queue, which the program would be continously watching. Except I can't find any timers other then _Timer_SetTimer which seems to require a GUI which I don't want. Is there another type of timer/clock something of the sort that is able to be run in the background.

Come on now, you are already running hundreds of windows, how can 1 more be of any problem?

If you really can't waste a few (kilo?)bytes of ram then upgrade to latest beta and use AdlibRegister().

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