I'm trying to show how much time has elapsed in a mission. Here is what I have:
function SecondsToClock(seconds)
local seconds = tonumber(seconds)
if seconds <= 0 then
return "00:00:00";
else
hours = string.format("%02.f", math.floor(seconds/3600));
mins = string.format("%02.f", math.floor(seconds/60 - (hours*60)));
secs = string.format("%02.f", math.floor(seconds - hours*3600 - mins *60));
return hours..":"..mins..":"..secs
end
end
local _theTime = mist.getClockString(SecondsToClock(timer.getTime()))
local _string = 'Current Mission Time: ' .. _theTime
trigger.action.outTextForGroup(1, _string, 30, false)
The output is always 00:00:00
The timer.getTime() function is supposed to give the seconds elapsed so I take that value, convert it to HH:MM:SS converted to string to display. I'm not sure if I'm over complicating things. There should be a way to do this. Googling doesn't reveal much.
Any help would be appreciated.
Thanks