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