• 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 won't update?

Status
Not open for further replies.
Hi, I'm working on a TD, Paintball TD (link in my sig) and I'm in the process of creating a multiboard for it. There will be one multiboard for each player, and I've got it creating and displaying the boards just fine. Now the problem is, whenever I try to update the multiboard (I've made the triggers to update the time remaining to the next wave and to update which wave you are currently on), it doesn't display on screen. These are my triggers:

JASS:
function Trig_TimerUpdate_Actions takes nothing returns nothing
    local integer i = 0
    local integer time
    loop
        exitwhen i >= MAX_PLAYERS
        
        if udg_IsPlayerPlaying[i] then
            set time = R2I(TimerGetRemaining(udg_WaveTimers[i]))
            call MultiboardSetItemValueBJ(udg_Multiboards[i], udg_NumPlayers+4, 1, I2S(time) + " seconds")
        endif
        
        set i = i + 1
    endloop
endfunction

//===========================================================================
function InitTrig_TimerUpdate takes nothing returns nothing
    set gg_trg_TimerUpdate = CreateTrigger(  )
    call TriggerRegisterTimerEvent( gg_trg_TimerUpdate, 1.00, true )
    call TriggerAddAction( gg_trg_TimerUpdate, function Trig_TimerUpdate_Actions )
endfunction
JASS:
function NextWave takes nothing returns nothing
    local integer i = 0
    local timer tim = GetExpiredTimer()
    
    loop
        exitwhen i >= MAX_PLAYERS or udg_WaveTimers[i] == tim
        set i = i + 1
    endloop
    
    if i >= MAX_PLAYERS then
        debug call BJDebugMsg("ERROR: Some dodgy timer called NextWave!")
        return
    endif
    
    call CreepTypes[udg_Levels[i]].Spawn(i)
    set udg_Levels[i] = udg_Levels[i] + 1
    
    call MultiboardSetItemValueBJ(udg_Multiboards[i], udg_NumPlayers+2, 2, I2S(udg_Levels[i]))
    
    set tim = null
endfunction

function Trig_Next_Wave_Actions takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i >= MAX_PLAYERS
        if udg_IsPlayerPlaying[i] then
            call TimerStart(udg_WaveTimers[i], WAVE_TIMER, true, function NextWave)
        endif
        set i = i + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Next_Wave takes nothing returns nothing
    set gg_trg_Next_Wave = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_Next_Wave, 0.01, false)
    call TriggerAddAction(gg_trg_Next_Wave, function Trig_Next_Wave_Actions)
endfunction
 
That works - debug messages show when I put them inside the if statement, but here goes...
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Visibility --------
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • -------- Regions --------
      • Set BuildRegions[0] = Player 1 Build Area <gen>
      • Set BuildRegions[1] = Player 2 Build Area <gen>
      • Set BuildRegions[2] = Player 3 Build Area <gen>
      • Set BuildRegions[3] = Player 4 Build Area <gen>
      • Set PaintFactoryRegions[0] = Player 1 Paint Factory <gen>
      • Set PaintFactoryRegions[1] = Player 2 Paint Factory <gen>
      • Set PaintFactoryRegions[2] = Player 3 Paint Factory <gen>
      • Set PaintFactoryRegions[3] = Player 4 Paint Factory <gen>
      • Set SpawnRegions[0] = Player 1 Spawn Point <gen>
      • -------- Cameras --------
      • Set BuildCameras[0] = Player 1 Build Area <gen>
      • Set BuildCameras[1] = Player 2 Build Area <gen>
      • Set BuildCameras[2] = Player 3 Build Area <gen>
      • Set BuildCameras[3] = Player 4 Build Area <gen>
      • Set PaintFactoryCameras[0] = Player 1 Paint Factory <gen>
      • Set PaintFactoryCameras[1] = Player 2 Paint Factory <gen>
      • Set PaintFactoryCameras[2] = Player 3 Paint Factory <gen>
      • Set PaintFactoryCameras[3] = Player 4 Paint Factory <gen>
      • -------- Players --------
      • For each (Integer A) from 0 to 7, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(((Integer A) + 1))) slot status) Equal to Is playing
              • ((Player(((Integer A) + 1))) controller) Equal to User
            • Then - Actions
              • Set IsPlayerPlaying[(Integer A)] = True
              • Set NumPlayers = (NumPlayers + 1)
              • Set TempPoint = (Center of PaintFactoryRegions[(Integer A)])
              • Unit - Create 1 Paint Factory for (Player(((Integer A) + 1))) at TempPoint facing Default building facing degrees
              • Set PaintFactories[(Integer A)] = (Last created unit)
              • Unit - Create 1 Paintball TD for (Player(((Integer A) + 1))) at ((Player(((Integer A) + 1))) start location) facing Default building facing degrees
              • Set MainTowers[(Integer A)] = (Last created unit)
              • Selection - Select (Last created unit) for (Player(((Integer A) + 1)))
              • Player - Disable Debris for (Player(((Integer A) + 1)))
              • Player - Disable Paintballers for (Player(((Integer A) + 1)))
              • Player - Disable Gun Manufacturer for (Player(((Integer A) + 1)))
              • Player - Set (Player(((Integer A) + 1))) Current gold to 10000
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
      • -------- Message --------
      • Game - Display to (All players) the text: Welcome to Paintbal...
*bump*
It's still not solved. Anyone have any ideas?

*bump*
Doesn't ANYONE have any idea???

*bump*
Yet again...

*bump*...

EDIT: This is where I create and show the multiboards:

JASS:
scope MultiboardSetup initializer Init

private function MakeMultiboard takes nothing returns nothing
    local integer i = 0
    local integer j
    local integer curRow
    
    local timer tim = GetExpiredTimer()
    
    loop
        exitwhen i >= MAX_PLAYERS
        
        if udg_IsPlayerPlaying[i] then
            set udg_Multiboards[i] = CreateMultiboard()
            
            call MultiboardSetRowCount(udg_Multiboards[i], udg_NumPlayers+5)
            call MultiboardSetColumnCount(udg_Multiboards[i], 2)
            call MultiboardSetTitleText(udg_Multiboards[i], "Paint TD - Player "+I2S(i+1))
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, 1, "Player")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, 1, "Kills")
            
            set j = 0
            set curRow = 0
            
            loop
                exitwhen j >= MAX_PLAYERS
                
                if udg_IsPlayerPlaying[j] then
                    set curRow = curRow + 1
                    call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, curRow + 1, GetPlayerNameColoured(Player(j)))
                    call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, curRow + 1, "0")
                endif
                
                set j = j + 1
            endloop
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+3, "Lives:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+3, I2S(START_LIVES))
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+4, "Current wave:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+4, "0")
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+5, "Time until next wave:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+5, I2S(R2I(WAVE_TIMER))+" seconds")
            
            call MultiboardSetItemWidthBJ(udg_Multiboards[i], 1, 0, 20.00)
            call MultiboardSetItemWidthBJ(udg_Multiboards[i], 2, 0, 10.00)
            
            call MultiboardSetItemsStyle(udg_Multiboards[i], true, false)
            
            if GetLocalPlayer() == Player(i) then
                call MultiboardDisplay(udg_Multiboards[i], true)
            endif
        endif
        
        set i = i + 1
    endloop
    
    call PauseTimer(tim)
    call DestroyTimer(tim)
    set tim = null
endfunction

private function Init takes nothing returns nothing
    local timer tim = CreateTimer()
    call TimerStart(tim, 0.1, false, function MakeMultiboard)
    set tim = null
endfunction

endscope

EDIT:
Did what DSG said in chat - it doesn't fix anything...

JASS:
scope MultiboardSetup initializer Init

private function MakeMultiboard takes nothing returns nothing
    local integer i = 0
    local integer j
    local integer curRow
    
    local timer tim = GetExpiredTimer()
    
    loop
        exitwhen i >= MAX_PLAYERS
        
        if udg_IsPlayerPlaying[i] then
            set udg_Multiboards[i] = CreateMultiboard()
            
            call MultiboardSetRowCount(udg_Multiboards[i], udg_NumPlayers+5)
            call MultiboardSetColumnCount(udg_Multiboards[i], 2)
            call MultiboardSetTitleText(udg_Multiboards[i], "Paint TD - Player "+I2S(i+1))
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, 1, "Player")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, 1, "Kills")
            
            set j = 0
            set curRow = 0
            
            loop
                exitwhen j >= MAX_PLAYERS
                
                if udg_IsPlayerPlaying[j] then
                    set curRow = curRow + 1
                    call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, curRow + 1, GetPlayerNameColoured(Player(j)))
                    call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, curRow + 1, "0")
                endif
                
                set j = j + 1
            endloop
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+3, "Lives:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+3, I2S(START_LIVES))
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+4, "Current wave:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+4, "0")
            
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 1, udg_NumPlayers+5, "Time until next wave:")
            call MultiboardSetItemValueBJ(udg_Multiboards[i], 2, udg_NumPlayers+5, I2S(R2I(WAVE_TIMER))+" seconds")
            
            call MultiboardSetItemWidthBJ(udg_Multiboards[i], 1, 0, 20.00)
            call MultiboardSetItemWidthBJ(udg_Multiboards[i], 2, 0, 10.00)
            
            call MultiboardSetItemsStyle(udg_Multiboards[i], true, false)
            
            call MultiboardDisplay(udg_Multiboards[i], false)
        endif
        
        set i = i + 1
    endloop
    
    set i = 0
    loop
        exitwhen i >= MAX_PLAYERS
        
        if GetLocalPlayer() == Player(i) and udg_IsPlayerPlaying[i] then
            call MultiboardDisplay(udg_Multiboards[i], true)
        endif
        
        set i = i + 1
    endloop
    
    call PauseTimer(tim)
    call DestroyTimer(tim)
    set tim = null
endfunction

private function Init takes nothing returns nothing
    local timer tim = CreateTimer()
    call TimerStart(tim, 0.1, false, function MakeMultiboard)
    set tim = null
endfunction

endscope
 

Attachments

  • screenshot.JPG
    screenshot.JPG
    211 KB · Views: 82
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Check the update system if the multiboarditems being manipulated match the ones they are meant to be. I believe the problem is as simple as you are updating the wrong multiboarditem (cell).

Also make sure that the update code actually runs. Some of the calls before it might hit the opt limate or pause it so the update never occurs.
 
ehm, well your problem is that it doesnt update... and this is because there is nothing to update, it's always the same :O
It updates it based on the time remaining...

Check the update system if the multiboarditems being manipulated match the ones they are meant to be. I believe the problem is as simple as you are updating the wrong multiboarditem (cell).
Yeah, there is a stupid error in the code I posted, but it is fixed in my actual code.

Also make sure that the update code actually runs. Some of the calls before it might hit the opt limate or pause it so the update never occurs.
Debug messages placed after the update call display in-game.
 
The one being updated is certainly the right one, but I guess I'll see if the natives work. My only problem there is that I can't seem to get it to even display properly in the first place if I just use natives.

EDIT:
Yey, thank you DSG! I made my own function:
JASS:
function UpdateMultiboard takes multiboard whichBoard, integer row, integer column, string val returns nothing
    local multiboarditem mbitem = MultiboardGetItem(whichBoard, row, column)
    call MultiboardSetItemValue(mbitem, val)
    call MultiboardReleaseItem(mbitem)
    set mbitem = null
endfunction
to replace the native, and now it works!
 
Last edited:
Status
Not open for further replies.
Top