View Full Version : Timer help needed
jwilson56
May 4th, 2007, 08:21 AM
I want to set a NR variable to "1" and popup a frame on a G5 event (actually I have that working using some TREE actions) but I also want that variable set back to "0" in 60 seconds to re-hide that popup frame.
I need some help to accomplish this.
Thanks
John
Promixis
May 4th, 2007, 08:31 AM
John,
A simple way to do something in a delayed manner is...
local function delayedfunction ()
print ('delayed function')
end
Classes.DelayedExecutionDispatcher:New (1000,delayedfunction)
the function delayedfunction will be called in 1000 ms.
jwilson56
May 4th, 2007, 08:54 AM
Thanks... now for one addition for yet another function I need.... how would you do the same thing but if the event it re-triggered before the delay time is over that it would restart the delay.
So say the delay was 5 minutes and the event got triggered... and then re-triggered in 3 minutes the actual function would not happen for 8 minutes.
Thanks
John
Promixis
May 4th, 2007, 09:11 AM
In this case, you can do 1 of 2 things.
1. Stop the first dispatcher and create a new one
2. Extend the time of the first...
And, you need to know that this object is meant to only fire once... after that it is dead.
The easiest, is going to be doing number 1.
local function delayedfunction ()
print ('delayed function')
end
if myDED then -- kills an existing dispatcher
myDED:Close ()
myDED = nil
end
myDED = Classes.DelayedExecutionDispatcher:New (1000,delayedfunction)
you can also extend the time until the dispatcher fires...
myDED:Extend (5000) -- fire in 5000 ms.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.