Economy-x-Talk - Sample Scripts
Countdown Timer 3
Display time on the card by placing a field onto the card (or background if you want it on more than one cards). Then, all you would have to do is place the time remaining onto that field. You may want to modify the IDLE handler to go to a card when the timeRemains(50)<1; I use <1 to prevent some kinds of tinkering that might set theTime to -1 or something.
This script has been slightly adjusted to allow for interrupting the countdown.
-- MP0werd
on startTimer
global theTime
--call startTimer when you want to start the timer
put the seconds into theTime
end startTimer
function timeRemains totaltime
global theTime
--get timeRemains(totaltime) when you want to find the amount of time left
put the seconds into timeNow
put timeNow-theTime into elapsed
put totaltime-elapsed into timeLeft
return timeLeft
end timeRemains
function endTimer
global theTime
-- get endTimer() to stop the timer and return the number of seconds remaining
return timeRemains(50)
-- change 50 to the number of seconds this test should take
put "" into thetime
end endTimer
-- original idle handler
-- on idle
-- global theTime
-- if theTime<>"" then put timeRemains(50) into cd fld "MyTotallyCoolField"
-- -- change 50 to the number of seconds this test should take
-- -- Change myTotallyCoolField to whatever your field is
-- end idle
on idle
global theTime
if theTime<>"" then
if timeRemains(10) <1 then
put "" into theTime
play "Boing"
put 0 into cd fld "MyTotallyCoolField"
else
put timeRemains(10) into cd fld "MyTotallyCoolField"
end if
end if
end idle
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.