HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Basic Multiboard: Troubleshoot

02-19-2007, 12:27 AM#1
Fulla
So I thought I'd do a multiboard in Jass.
Starting off very basic and gradually making it more complex.

Yet very basic seems to screw up cometeply



Basically just adding each active player to board + teams + gametime.

Collapse JASS:
function Trig_Multiboard_Actions takes nothing returns nothing
    local integer i = 0
    local integer f = 0
    local integer h = 0
    
    loop
        exitwhen i == 12
        set f = f + 1
        if Player(i) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
            set udg_Player_Board[f] = Player(i)
            set h = h + 1
        endif
        set i = i + 1
    endloop        
    
    set udg_Player_Count = h
    set h = h + 6
    call CreateMultiboardBJ(4, h, "www.Clancbs.com")
    set udg_Multiboard = GetLastCreatedMultiboard()
    set f = 3
    
    loop
        exitwhen f == 0
        set f = f - 1
        set i = 0
        loop
            exitwhen i > h
            set i = i + 1
            call MultiboardSetItemStyleBJ(udg_Multiboard, 2, i, true, false)
            call MultiboardSetItemStyleBJ(udg_Multiboard, 3, i, true, false)
            call MultiboardSetItemStyleBJ(udg_Multiboard, 4, i, true, false)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 1, i, 10.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 2, i, 3.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 3, i, 3.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 4, i, 3.00)
            call MultiboardSetItemIconBJ(udg_Multiboard, 1, i, "ReplaceableTextures\\CommandButtons\\BTNBlank.blp")
        endloop
    endloop
    
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, 1, "Players")
    call MultiboardSetItemValueBJ(udg_Multiboard, 2, 1, "Dead?")
    call MultiboardSetItemValueBJ(udg_Multiboard, 3, 1, "Kills")
    call MultiboardSetItemValueBJ(udg_Multiboard, 4, 1, "Death")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 4, "Sentinel")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 5, "Scourge")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 7, "Game Time")
    
    set i = 0
    loop
        exitwhen i > udg_Player_Count
        set i = i + 1
        call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 1, GetPlayerName(udg_Player_Board[i]))
    endloop
    
endfunction

//===========================================================================
function InitTrig_Multiboard takes nothing returns nothing
    set gg_trg_Multiboard = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Multiboard, 0.01 )
    call TriggerAddAction( gg_trg_Multiboard, function Trig_Multiboard_Actions )
endfunction

thx for anyhelp.
02-19-2007, 02:39 AM#2
emjlr3
i don't know man, mbs are weird in JASS

I stick to GUI, cuz i've tried before, and even just converting my trigger to JASS after finishing it, and using locals instead of globals in the trigger screws it up completely, no idea as to y
02-19-2007, 03:34 AM#3
Ammorth
Collapse JASS:
function Trig_Multiboard_Actions takes nothing returns nothing
    local integer i = 0
    local integer f = 0
    local integer h = 0
    
    loop
        exitwhen i == 12
        set f = f + 1
        if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
            set udg_Player_Board[f] = Player(i)
            set h = h + 1
        endif
        set i = i + 1
    endloop        
    
    set udg_Player_Count = h
    set h = h + 6 
    set udg_Multiboard = CreateMultiboardBJ(4, h, "www.Clancbs.com")
    set f = 3
    
    loop
        exitwhen f == 0
        set f = f - 1
        set i = 0
        loop
            exitwhen i > h
            set i = i + 1
            call MultiboardSetItemStyleBJ(udg_Multiboard, 2, i, true, false)
            call MultiboardSetItemStyleBJ(udg_Multiboard, 3, i, true, false)
            call MultiboardSetItemStyleBJ(udg_Multiboard, 4, i, true, false)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 1, i, 10.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 2, i, 3.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 3, i, 3.00)
            call MultiboardSetItemWidthBJ(udg_Multiboard, 4, i, 3.00)
            call MultiboardSetItemIconBJ(udg_Multiboard, 1, i, "ReplaceableTextures\\CommandButtons\\BTNBlank.blp")
        endloop
    endloop
    
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, 1, "Players")
    call MultiboardSetItemValueBJ(udg_Multiboard, 2, 1, "Dead?")
    call MultiboardSetItemValueBJ(udg_Multiboard, 3, 1, "Kills")
    call MultiboardSetItemValueBJ(udg_Multiboard, 4, 1, "Death")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 4, "Sentinel")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 5, "Scourge")
    call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 7, "Game Time")
    
    set i = 0
    loop
        exitwhen i > udg_Player_Count
        set i = i + 1
        call MultiboardSetItemValueBJ(udg_Multiboard, 1, udg_Player_Count + 1, GetPlayerName(udg_Player_Board[i]))
    endloop
    
endfunction

//===========================================================================
function InitTrig_Multiboard takes nothing returns nothing
    set gg_trg_Multiboard = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Multiboard, 0.01 )
    call TriggerAddAction( gg_trg_Multiboard, function Trig_Multiboard_Actions )
endfunction

Change the obvious first, and then post a new screenshot.

I would recommend that you keep the number of row/columns static. This is the easiest multiboard. Then you can change the values to "Unused" or "Has left the Game" when there is no player, or someone leaves. Also, try remove the BJ calls.
02-19-2007, 04:32 AM#4
zen87
well multiboard are fine in jass, instead, it is easier to do multi board in jass, here is my multiboard for my TD, it includes a game time, well hope it helps, and yeah, totally bj-less

Collapse JASS:
globals //say NO to the lame-timewasting-udg_ globals
multiboard GameMultiboard
integer array PlayerLife
integer array PlayerKill
integer ClockSec = 0
integer ClockMin = 0
endglobals

function GameClock takes nothing returns nothing
 local integer i = 0
 local integer n = 0
    set ClockSec=ClockSec+1
    if ClockSec>=60 then
        set ClockSec=ClockSec-60
        set ClockMin=ClockMin+1
    endif
    if ClockSec<10 then
        call MultiboardSetItemValue(MultiboardGetItem(GameMultiboard,1,1),I2S(ClockMin)+":0"+I2S(ClockSec))
    else
        call MultiboardSetItemValue(MultiboardGetItem(GameMultiboard,1,1),I2S(ClockMin)+":"+I2S(ClockSec))
    endif
    loop
        set i=PlayerLife[n]
        if i!=0 then
            call MultiboardSetItemValue(MultiboardGetItem(GameMultiboard,n+6,1),I2S(i))
        endif
        set i=PlayerKill[n]
        if i!=0 then
            call MultiboardSetItemValue(MultiboardGetItem(GameMultiboard,n+6,2),I2S(i))
        endif
        set n=n+1
        exitwhen n>7
    endloop
    call MultiboardSetTitleTextColor(GameMultiboard,GetRandomInt(2,9)*25,GetRandomInt(2,9)*25,GetRandomInt(2,9)*25,0)
endfunction

function IntiMultiboard takes nothing returns nothing
 local integer n = 0
 local integer i = 6
 local integer c = 0
 local string array name
 local multiboarditem it = null
    loop
        if GetPlayerSlotState(Player(n)) == ConvertPlayerSlotState(1) then
            set i=i+1
            set name[i-7] = GetPlayerName(Player(n))
        endif
        set n=n+1
        exitwhen n>7
    endloop

    set GameMultiboard=CreateMultiboard()
    call MultiboardSetTitleText(GameMultiboard,"Thief TD")
    call MultiboardSetRowCount(GameMultiboard,i+1)
    call MultiboardSetColumnCount(GameMultiboard,3)

    set n=0
    loop

        set it = MultiboardGetItem(GameMultiboard,n,c)
        call MultiboardSetItemStyle(it,true,false)

        if c==0 then
            call MultiboardSetItemWidth(it,0.08)
            if n==0 then
                call MultiboardSetItemValue(it,"Current Level")
            elseif n==1 then
                call MultiboardSetItemValue(it,"Game Started")
            elseif n==2 then
                call MultiboardSetItemValue(it,"")
            elseif n==3 then
                call MultiboardSetItemValue(it,"")
            elseif n==5 then
                call MultiboardSetItemValue(it,"|cffffdeadPlayer Names|r")
            elseif n>5 and n!=i then
                call MultiboardSetItemValue(it,name[n-6])
                set name[n-6]=null
            endif
        elseif c==1 then
            call MultiboardSetItemWidth(it,0.05)
            if n==0 then
                call MultiboardSetItemValue(it,"0")
            elseif n==5 then
                call MultiboardSetItemValue(it,"|c0000ff00Lives|r")
            elseif n>5 and n!=i then
                call MultiboardSetItemValue(it,"15")
            endif
        elseif c==2 then
            call MultiboardSetItemWidth(it,0.05)
            if n==5 then
                call MultiboardSetItemValue(it,"|c00ff0000Kills|r")
            elseif n>5 and n!=i then
                call MultiboardSetItemValue(it,"0")
            endif
        endif

        call MultiboardReleaseItem(it)
        set n=n+1
        if n>i then
            set n=0
            set c=c+1
        endif
        exitwhen c>2
    endloop

    call MultiboardDisplay(GameMultiboard,true)
    set ClockSec=8
    call TimerStart(NewTimer(),1.,true,function GameClock)

 set it=null
endfunction

//===========================================================================
function InitTrig_Game_Multiboard takes nothing returns nothing
endfunction

02-20-2007, 09:24 PM#5
Fulla
Ok I tried to go completely JASS, without BJ's, just like the above.

this is how it should look:
Zoom (requires log in)

this is how it ended up looking:
Zoom (requires log in)



Heres the code:
Collapse JASS:
function Trig_Multiboard_Actions takes nothing returns nothing
    local integer n = 0
    local integer i = 0
    local integer c = 0
    local multiboarditem it = null
    
    loop
        exitwhen n == 12
        if GetPlayerSlotState(Player(n)) == ConvertPlayerSlotState(1) then
            if n == 0 or n == 1 or n == 2 or n == 3 or n == 4 or n == 5 then
                set udg_Player_Text[n + 1] = "|CFF00E632" + GetPlayerName(Player(n))
            elseif n == 6 or n == 7 or n == 8 or n == 9 or n == 10 or n == 11 then
                set udg_Player_Text[n + 1]  = "|CFFFFFF00" + GetPlayerName(Player(n))
            endif
            set udg_Player_Board[n + 1] = n
            set i = i + 1
        endif
        set n = n + 1
    endloop
        
    set udg_Player_Count = i
    set udg_Multiboard = CreateMultiboard()
    call MultiboardSetTitleText(udg_Multiboard, "www.clancbs.com")
    call MultiboardSetColumnCount(udg_Multiboard, 4)
    call MultiboardSetRowCount(udg_Multiboard, i + 6)
    
    set n = 0
    set c = 0
    
    loop
        set it = MultiboardGetItem(udg_Multiboard, n, c)
        call MultiboardSetItemStyle(it, true, false)
    
        if c == 0 then
            call MultiboardSetItemWidth(it,0.08)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Players")
            elseif n < i + 2  then
                 call MultiboardSetItemValue(it, udg_Player_Text[n + 1])
                 call MultiboardSetItemStyle(it, true, true)
            elseif n == i + 3 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[1])
            elseif n == i + 4 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[2])
            elseif n == i + 6 then
                 call MultiboardSetItemValue(it, "Time Elapsed")                                                                        
            endif
            
        elseif c == 1 then
            call MultiboardSetItemWidth(it,0.04)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Dead?")
            endif     
                    
        elseif c == 2 then
            call MultiboardSetItemWidth(it,0.03)
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFFFF0000Kills")
            elseif n != i + 2 or n != i + 5 or n != i + 6 then     
                 call MultiboardSetItemValue(it, "|CFFFF00000")
            endif
                   
        elseif c == 3 then
            call MultiboardSetItemWidth(it,0.03)        
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFF0064FFDeaths")     
            elseif n != i + 2 or n != i + 5 or n != i + 6 then     
                 call MultiboardSetItemValue(it, "|CFF0064FF0")
            endif
        endif
                             
        set n = n + 1
        if n > i + 5 then
            set n = 0
            set c = c + 1
        endif
        exitwhen c > 3
    endloop
            
    call MultiboardDisplay(udg_Multiboard, true)
    
endfunction

//===========================================================================
function InitTrig_Multiboard_Setup takes nothing returns nothing
    set gg_trg_Multiboard_Setup = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_Multiboard_Setup, 1.00)
    call TriggerAddAction(gg_trg_Multiboard_Setup, function Trig_Multiboard_Actions)
endfunction



EDIT:

Ok n/m I got it working thx for help guys, especially you Zen :D

Collapse JASS:
function Trig_Multiboard_Actions takes nothing returns nothing
    local integer n = 0
    local integer i = 0
    local integer c = 0
    local multiboarditem it = null
    
    loop
        exitwhen n == 12
        if GetPlayerSlotState(Player(n)) == ConvertPlayerSlotState(1) then
            if n == 0 or n == 1 or n == 2 or n == 3 or n == 4 or n == 5 then
                set udg_Player_Text[n + 1] = "|CFF00E632" + GetPlayerName(Player(n))
            elseif n == 6 or n == 7 or n == 8 or n == 9 or n == 10 or n == 11 then
                set udg_Player_Text[n + 1]  = "|CFFFFFF00" + GetPlayerName(Player(n))
            endif
            set udg_Player_Board[n + 1] = n
            set i = i + 1
        endif
        set n = n + 1
    endloop
        
    set udg_Player_Count = i
    set udg_Multiboard = CreateMultiboard()
    call MultiboardSetTitleText(udg_Multiboard, "www.clancbs.com")
    call MultiboardSetColumnCount(udg_Multiboard, 4)
    call MultiboardSetRowCount(udg_Multiboard, i + 6)
    
    set n = 0
    set c = 0
    
    loop
        set it = MultiboardGetItem(udg_Multiboard, n, c)
        call MultiboardSetItemStyle(it, true, false)
    
        if c == 0 then
            call MultiboardSetItemWidth(it,0.08)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Players")
            elseif n < i + 1 then
                 call MultiboardSetItemValue(it, udg_Player_Text[n])
                 call MultiboardSetItemStyle(it, true, true)
            elseif n == i + 2 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[1])
            elseif n == i + 3 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[2])
            elseif n == i + 5 then
                 call MultiboardSetItemValue(it, "Time Elapsed")                                                                        
            endif
            
        elseif c == 1 then
            call MultiboardSetItemWidth(it,0.04)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Dead?")
            endif     
                    
        elseif c == 2 then
            call MultiboardSetItemWidth(it,0.03)
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFFFF0000Kills")
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFFFF00000")
            endif
                   
        elseif c == 3 then
            call MultiboardSetItemWidth(it,0.03)        
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFF0064FFDeaths")     
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFF0064FF0")
            endif
        endif
                             
        set n = n + 1
        if n > i + 5 then
            set n = 0
            set c = c + 1
        endif
        exitwhen c > 3
    endloop
            
    call MultiboardDisplay(udg_Multiboard, true)
    set it = null
endfunction

//===========================================================================
function InitTrig_Multiboard_Setup takes nothing returns nothing
    set gg_trg_Multiboard_Setup = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_Multiboard_Setup, 1.00)
    call TriggerAddAction(gg_trg_Multiboard_Setup, function Trig_Multiboard_Actions)
endfunction
Attached Images
File type: jpgMb.JPG (14.0 KB)
File type: jpgMb2.JPG (7.3 KB)
02-20-2007, 10:06 PM#6
Joker
That multiboard looks exactly like dotas...
02-21-2007, 08:29 AM#7
Fulla
EDIT: FIXED (I got it working now)

Gah, ok it all works except team 2's names arent being added to multiboard??
This was a Test, Player 1/7 both on opposing teams.

Zoom (requires log in)

Code:
Collapse JASS:
function Trig_Multiboard_Actions takes nothing returns nothing
    local integer n = 0
    local integer i = 0
    local integer c = 0
    local multiboarditem it = null
    
    loop
        exitwhen n == 12
        if GetPlayerSlotState(Player(n)) == ConvertPlayerSlotState(1) then
            if n == 0 or n == 1 or n == 2 or n == 3 or n == 4 or n == 5 then
                set udg_Player_Text[n + 1] = "|CFF00E632" + GetPlayerName(Player(n))
            elseif n == 6 or n == 7 or n == 8 or n == 9 or n == 10 or n == 11 then
                set udg_Player_Text[n + 1]  = "|CFFFFFF00" + GetPlayerName(Player(n))
            endif
            set udg_Player_Board[n + 1] = n
            set i = i + 1
        endif
        set n = n + 1
    endloop
        
    set udg_Player_Count = i
    set udg_Multiboard = CreateMultiboard()
    call MultiboardSetTitleText(udg_Multiboard, "www.clancbs.com")
    call MultiboardSetColumnCount(udg_Multiboard, 4)
    call MultiboardSetRowCount(udg_Multiboard, i + 6)
    
    set n = 0
    set c = 0
    
    loop
        set it = MultiboardGetItem(udg_Multiboard, n, c)
        call MultiboardSetItemStyle(it, true, false)
    
        if c == 0 then
            call MultiboardSetItemWidth(it,0.08)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Players")
            elseif n < i + 1 then
                 call MultiboardSetItemValue(it, udg_Player_Text[n])
                 call MultiboardSetItemStyle(it, true, true)
            elseif n == i + 2 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[1])
            elseif n == i + 3 then
                 call MultiboardSetItemValue(it, udg_Player_Team_Text[2])
            elseif n == i + 5 then
                 call MultiboardSetItemValue(it, "Time Elapsed")                                                                        
            endif
            
        elseif c == 1 then
            call MultiboardSetItemWidth(it,0.04)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Dead?")
            endif     
                    
        elseif c == 2 then
            call MultiboardSetItemWidth(it,0.03)
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFFFF0000Kills")
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFFFF00000")
            endif
                   
        elseif c == 3 then
            call MultiboardSetItemWidth(it,0.03)        
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFF0064FFDeaths")     
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFF0064FF0")
            endif
        endif
                             
        set n = n + 1
        if n > i + 5 then
            set n = 0
            set c = c + 1
        endif
        exitwhen c > 3
    endloop
            
    call MultiboardDisplay(udg_Multiboard, true)
    set it = null
endfunction

//===========================================================================
function InitTrig_Multiboard_Setup takes nothing returns nothing
    set gg_trg_Multiboard_Setup = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_Multiboard_Setup, 1.00)
    call TriggerAddAction(gg_trg_Multiboard_Setup, function Trig_Multiboard_Actions)
endfunction
Attached Images
File type: jpgGah.JPG (8.3 KB)