PDA

View Full Version : Timer countdown



limboo
06-23-2008, 09:52 AM
can someone help me with this script? i want it to count down but not rely on systemtime

ON PRELOAD



bRunning = true;
nTimerResolution = 60; -- In miliseconds
nMillisecs = 0;
nSeconds = 0;
nMinutes = 5;
nHours =0;


Page.StartTimer(60)


function UpdateTimerTime()

if(nMillisecs >= 1000) then
nSeconds = nSeconds + 1;
nMillisecs = 0;
end

local nTenths = Math.Round(nMillisecs / 100, 1) * 10;

if(nSeconds > 59) then
nMinutes = nMinutes + 1;
nSeconds = 0;

end
if(nMinutes > 59) then
nHours = nHours + 1;
nMinutes = 0;
end
_at_comp = nHours*3600+nMinutes*60+nSeconds+nMillisecs*1000;

local strElapsed = string.format( "%.2d:%.2d"
, nMinutes
, nSeconds );
end

Input.SetText("Time", strElapsed)




ON TIMER



nMillisecs = nMillisecs + nTimerResolution;
UpdateTimerTime();



and i've tried the search function but i can't find an instant countdown timer

longedge
06-23-2008, 02:08 PM
I posted a timer here (http://www.indigorose.com/forums/showthread.php?t=21489) a while back.

limboo
06-24-2008, 08:04 AM
but i want it to countdown

holtgrewe
06-24-2008, 11:52 AM
but i want it to countdown

Here's a very simple countdown ap that may give you some ideas for your project.