• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Multiboard Timer

Status
Not open for further replies.
Level 12
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.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
call DestroyTrigger(GetTriggeringTrigger())
Try without it.
Destroying triggers can be very bad, especially when they start new threads.
 
Status
Not open for further replies.
Top