Originally posted by dvhh
just to correct (not really an issue)
function updateTimer()
dr_clear("timer")
dr_setautoclear("timer",0)
local time = Universe_GameTime();
local h = floor(time/3600.0);
local m = floor(time/60.0) - h*60;
local s = time - m*60;
local str = format("%2.0f: %02.0f: %02.0f",h, m, s)
dr_text2d("timer",0.0,0.98,str, 255,255,255)
end
however that would be a good start to find out the hw2-lua functions
Still got a bug in there, if the game goes over an hour. Try this:
Code:
function updateTimer()
dr_clear("timer")
dr_setautoclear("timer",0)
local time = Universe_GameTime()
local h = floor(time/3600.0)
local m = floor(time/60.0 - h*60)
local s = time - m*60 - h*3600
local str = format("%2.0f:%02.0f:%02.0f",h, m, s)
dr_text2d("timer",0.0,0.98,str, 255,255,255)
end
Rule_AddInterval("updateTimer", 1)
(afaik the semicolons in the original function are extraneous also)