- Joined
- Feb 23, 2007
- Messages
- 1,030
JASS:
scope GameTimer
globals
private timer t
private integer c
private string s
private string m
private multiboard b
private multiboarditem i
endglobals
private function Count takes nothing returns nothing
set c=c+1
if ModuloInteger(c,60)<10 then
set s="0"+I2S(ModuloInteger(c,60))
else
set s=I2S(ModuloInteger(c,60))
endif
if ModuloInteger((c/60),60)<10 then
set m="0"+I2S(ModuloInteger((c/60),60))
else
set m=I2S(ModuloInteger((c/60),60))
endif
call MultiboardSetItemValue(MultiboardGetItem(b,1,1),(I2S(c/3600)+(":"+(m+(":"+s)))))
endfunction
private function Actions takes nothing returns nothing
set t = CreateTimer()
set b = CreateMultiboard()
call MultiboardDisplay(b,true)
call MultiboardSetTitleText(b,"Timer")
call MultiboardSetColumnCount(b,1)
call MultiboardSetRowCount(b,1)
set i = MultiboardGetItem(b,1,1)
call MultiboardSetItemStyle(i,true,false)
call MultiboardSetItemWidth(i,4.5)
call MultiboardSetItemValueColor(i,0,100,0,50)
call TimerStart(t,1,true,function Count)
call DestroyTrigger(GetTriggeringTrigger())
endfunction
//===========================================================================
function InitTrig_GameTimer takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventSingle(t, 0)
call TriggerAddAction(t, function Actions)
set t = null
endfunction
endscope
Doesn't display time, please help. The multiboard shows up, but it doesn't display properly.