A Lingo Timer Script
Date: Thu, 9 Feb 1995 10:36:31 -0800
From: "Zavatone, Alex*" <azavatone@MACROMEDIA.COM>
Subject: Servicable Timer
Servicable timer. To initialize, call the timer with the number of seconds.
To check, call the timer again, a 1 will be returned if time is up. With
this timer events are not suspended like in a repeat loop. Also included is
a handler which will suspend events till time is out.
-- Timer Scripts (c) Alex Zavatone Feb 1, 1995
on timer seconds
global gTimerStart
if gtimerstart = 0 then
set gTimerStart = the ticks
end if
if 60 * seconds + gtimerStart < the ticks then on timer seconds
global gTimerStart
if gtimerstart = 0 then
set gTimerStart = the ticks
end if
if 60 * seconds + gtimerStart < the ticks then
put "time up" -- for debugging purposes
set myResult = true
set gTimerStart = 0
else
set myResult = false
end if
return myResult
end
on timeout seconds
repeat while not (timer (seconds))
end repeat
end