HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multiboard frustration

01-28-2008, 12:25 PM#1
SockSquirrelMouthwash
I've been trying to get a multiboard showing up properly for quite a bit now. I've finally got it to how I want it to look but there's one problem - it doesn't show it to all of the 6 players

It shows it perfectly for the first player, second player but not the rest. Kinda frustrating trying to figure out what's wrong after all this time... okay here's the function run at game start 2 seconds in:
Collapse JASS:
private function SetupMultiBoards takes nothing returns nothing
    local integer r
    local integer n
    local integer i
    local integer j
    local group v = CreateGroup()
    local unit u

    set r = 5
    call GroupAddGroup(udg_activeunits, v)
    loop
        set u = FirstOfGroup(v)
        exitwhen u == null
        set n = GetConvertedPlayerId(GetOwningPlayer(u))
        set udg_playerentry[n] = r
        set r = r + 1
        call GroupRemoveUnit(v,u)
    endloop 
    
    set i = 0
    loop
        exitwhen i == 6
        set i = i + 1

        // General Config of Main Multiboard
        set mboards[i] = CreateMultiboard()
        call MultiboardSetRowCount(mboards[i], CountPlayersInForceBJ(udg_activeplayers) + 4)
        call MultiboardSetColumnCount(mboards[i], 12)
        call MultiboardSetItemsWidth( mboards[i], 0.2 )
        call MultiboardSetTitleText(mboards[i], "Info Board")
        call multiboardadjust(mboards[i])

        call GroupAddGroup(udg_activeunits, v)
        loop
            set u = FirstOfGroup(v)
            exitwhen u == null
            set n = GetConvertedPlayerId(GetOwningPlayer(u))
            set udg_outerhp[n] = 15000
            set hpbar[n+(i-1)*6] = Multibar.create(mboards[i], 1, udg_playerentry[n]-1, 10, udg_outerhp[n], udg_outerhp[n], MULTIBAR_TYPE_RADIO)
            call MultiboardSetItemValueBJ( mboards[i], 1, udg_playerentry[n], udg_playernames[n] )
            call MultiboardSetItemWidthBJ( mboards[i], 1, udg_playerentry[n], 8.00 )
            call MultiboardSetItemStyleBJ( mboards[i], 1, udg_playerentry[n], true, false )
            call MultiboardSetItemWidthBJ( mboards[i], 11, udg_playerentry[n], 3.25 )
            call MultiboardSetItemValueBJ( mboards[i], 12, udg_playerentry[n], "|CFF00FF003/3|R" )
            call MultiboardSetItemWidthBJ( mboards[i], 12, udg_playerentry[n], 3.50 )
            call MultiboardSetItemStyleBJ( mboards[i], 12, udg_playerentry[n], true, false )
            call GroupRemoveUnit(v,u)
        endloop
        
        if GetLocalPlayer() == Player(i-1) then
            call MultiboardDisplay( mboards[GetConvertedPlayerId(Player(i-1))], true )
        endif
    endloop
    
    call DestroyGroup(v)
    set v = null
    set u = null
    call DestroyTrigger(GetTriggeringTrigger())
endfunction

and multiboardadjust is just:
Collapse JASS:
private function multiboardadjust takes multiboard m returns nothing
    local integer i
    local integer j
    local multiboard mb = m

    // Disable Icons
    set i = 0
    set j = 0    
    loop
        exitwhen i == 4
        set i = i + 1
        loop
            exitwhen j == 12
            set j = j + 1            
            call MultiboardSetItemStyleBJ( mb, j, i, true, false )
        endloop
        set j = 0
    endloop

    // Row 1
    call MultiboardSetItemValueBJ( mb, 1, 1, "Host Setting Up Game..." )
    call MultiboardSetItemWidthBJ( mb, 1, 1, 15.00 )
    call MultiboardSetItemWidthBJ( mb, 2, 1, 2.00 )
    call MultiboardSetItemWidthBJ( mb, 3, 1, 8.00 )
    call MultiboardSetItemWidthBJ( mb, 4, 1, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 5, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 6, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 7, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 8, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 9, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 10, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 11, 1, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 12, 1, 0.00 )
    
    // Row 2
    call MultiboardSetItemValueBJ( mb, 1, 2, "Wave Type" )
    call MultiboardSetItemWidthBJ( mb, 1, 2, 10.00 )
    call MultiboardSetItemWidthBJ( mb, 2, 2, 10.00 )
    call MultiboardSetItemWidthBJ( mb, 3, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 4, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 5, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 6, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 7, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 8, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 9, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 10, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 11, 2, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 12, 2, 0.00 )    

    // Row 3
    call MultiboardSetItemWidthBJ( mb, 1, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 2, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 3, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 4, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 5, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 6, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 7, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 8, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 9, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 10, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 11, 3, 0.00 )
    call MultiboardSetItemWidthBJ( mb, 12, 3, 0.00 )
    
    // Row 4
    call MultiboardSetItemWidthBJ( mb, 1, 4, 1.50 )
    call MultiboardSetItemValueBJ( mb, 2, 4, "Defender" )
    call MultiboardSetItemWidthBJ( mb, 2, 4, 9.00 )
    call MultiboardSetItemValueBJ( mb, 3, 4, "Defense HP" )
    call MultiboardSetItemWidthBJ( mb, 3, 4, 9.00 )
    call MultiboardSetItemValueBJ( mb, 4, 4, "Gates Left" ) 
    call MultiboardSetItemWidthBJ( mb, 4, 4, 5.00 )
    call MultiboardSetItemWidthBJ( mb, 5, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 6, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 7, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 8, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 9, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 10, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 11, 4, 0.00 )    
    call MultiboardSetItemWidthBJ( mb, 12, 4, 0.00 )    
endfunction

Like I said, it shows up perfectly for player 1 at least, kinda cut off for players 2-3 at times, but it doesn't show up for players 4,5,6!

Help greatly appreciated!
01-28-2008, 01:38 PM#2
Deaod
call MultiboardDisplay( mboards[GetConvertedPlayerId(Player(i-1))], true )
replace the highlighted part with " i " since its really the exact same. Other than that, i dont know where a problem could arise.
01-28-2008, 01:53 PM#3
SockSquirrelMouthwash
Quote:
Originally Posted by Deaod
call MultiboardDisplay( mboards[GetConvertedPlayerId(Player(i-1))], true )
replace the highlighted part with " i " since its really the exact same. Other than that, i dont know where a problem could arise.

I'll go ahead and change it

yeah I figured that too whenever I go over it, but it just acts weird with the other players aside from player 1 and more or less does not show up period

update: changed the said text to i and still no change :(
01-28-2008, 06:46 PM#4
Ammorth
Calling Player(i-1) the first time should cause war3 to crash (i = 0 so i - 1 = -1 which causes a crash.

Your problem is here:
Collapse JASS:
        if GetLocalPlayer() == Player(i) then
            call MultiboardDisplay( mboards[i], true )
        endif

Removing the -1 and removing the GetConvertedPlayerId garbage should fix your problem.
01-28-2008, 07:57 PM#5
Deaod
the loop starts with
Collapse JASS:
     set i = 0
    loop
        exitwhen i == 6
        set i = i + 1

so i is 1 the first time it runs the loop.
01-28-2008, 08:39 PM#6
SockSquirrelMouthwash
Still not showing

Banging my head on the wall here
01-28-2008, 09:07 PM#7
Ammorth
Hmm, if you can post a demo map or want to send me a map via pm or email, I can take a look at it for you.

email: ammorth[at]gmail[dot]com

Edit: You are hitting the op limit in your function, during the creation of the forth multiboard. I believe this is due to the crappy-ness of the multiboard functions. Ill see if I can make a workaround.

In-place of all your set multiboard width, use this function:

Collapse JASS:
function SetMultiboardItem takes multiboard mb, integer row, integer col, real width, string value, boolean showvalue, boolean showicon returns nothing
    local multiboarditem mbi = MultiboardGetItem(mb, row-1, col-1)
    call MultiboardSetItemWidth(mbi, width/100)
    call MultiboardSetItemValue(mbi, value)
    call MultiboardSetItemStyle(mbi, showvalue, showicon)
    call MultiboardReleaseItem(mbi)
    set mbi = null
endfunction

It should remove the op limit.

For further optimization you could have a couple of these, 1 for only width, another for width and text, etc.
01-29-2008, 04:11 AM#8
SockSquirrelMouthwash
Quote:
Originally Posted by Ammorth
Hmm, if you can post a demo map or want to send me a map via pm or email, I can take a look at it for you.

email: ammorth[at]gmail[dot]com

Edit: You are hitting the op limit in your function, during the creation of the forth multiboard. I believe this is due to the crappy-ness of the multiboard functions. Ill see if I can make a workaround.

In-place of all your set multiboard width, use this function:

Collapse JASS:
function SetMultiboardItem takes multiboard mb, integer row, integer col, real width, string value, boolean showvalue, boolean showicon returns nothing
    local multiboarditem mbi = MultiboardGetItem(mb, row-1, col-1)
    call MultiboardSetItemWidth(mbi, width/100)
    call MultiboardSetItemValue(mbi, value)
    call MultiboardSetItemStyle(mbi, showvalue, showicon)
    call MultiboardReleaseItem(mbi)
    set mbi = null
endfunction

It should remove the op limit.

For further optimization you could have a couple of these, 1 for only width, another for width and text, etc.

Holy crap! that seems to be doing the trick! I'm trying all player slots and getting a multiboard to show!... gonna have to test it with some people to ensure it works properly hehe

Now concerning this op limit... are there any other limits I should be wary about spamming in a function?
01-29-2008, 06:11 AM#9
Ammorth
op limit is the just a fancy way of saying operation limit. Blizzard designed jass to only execute so much data per thread. If they didn't computers could lock-up in an infinite loop (can be a security and stability problem).

If you are using the JassNewGen Pack, make sure you enable war3err while testing. This will provide you with errors in your map script that cause thread crushes as well as crashes (how I found out the thread op-ed).

The reason why the BJs caused the op limit is because they do many loops through the multiboard (depends on the size). That function does not loop, so it does less calculations.

If you are having problems with getting everything run in a single thread and you hit the op limit, you can use ExecuteFunction("functionName") to create a new thread for the function. Only down-side is that you can't pass any arguments to the function, but you can use globals.
01-29-2008, 06:40 AM#10
Pyrogasm
Quote:
Originally Posted by Ammorth
...thread crushes as well as crashes...
There's a difference? I always just thought Toadcop failed at saying "crash" so he said "crush" instead.
01-29-2008, 07:07 AM#11
Ammorth
maybe I picked up on the slang.

I think a crash is when you get the "war3.exe has caused a critical error" yada yada (example: when you call Player(-1)). A crush is when your thread stops (example: set integer = 1/0)
01-29-2008, 11:00 AM#12
SockSquirrelMouthwash
Nice, well thanks a bunch Ammorth! saved my day once again hehe