• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Multiboard display broken

Status
Not open for further replies.
Level 9
Joined
Dec 31, 2016
Messages
315
So I've got this jass script to show each player their own multiboard, but it does correctly work only for red player.
JASS:
function Multiboard_Set takes nothing returns nothing
    local integer i = 1
    local integer x = 1
    call TriggerSleepAction( 0.00 )

    loop
        exitwhen i > 8
        set udg_Multiboard[i] = CreateMultiboardBJ( 3, 11, "Overview")
        call MultiboardDisplayBJ( false, udg_Multiboard[i] )
        loop
            exitwhen x > 11
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 2, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 3, x + 1, true, false )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 1, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 2, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 3, x, 6.00 )
            set x = x + 1
        endloop
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 1, 1, "ReplaceableTextures\\CommandButtons\\BTNTemp.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 2, 1, "ReplaceableTextures\\CommandButtons\\BTNChestOfGold.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 3, 1, "ReplaceableTextures\\CommandButtons\\BTNWisp.blp" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 1, "Player" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 1, "Income" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 1, "Lumber" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 7, "Your Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 8, "Enemy Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 10, "Gold in Bank" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 11, "Needed" )
        set i = i + 1
    endloop
 
    set i = 1
    loop
        exitwhen i > 4
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FF0303" + GetPlayerName(Player(0)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c000042FF" + GetPlayerName(Player(1)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c001CE6B9" + GetPlayerName(Player(2)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00540081" + GetPlayerName(Player(3)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(0))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(1))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(2))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(3))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(0))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(0))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(1))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(1))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(2))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(2))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(3))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(3))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelRight]) )
        set i = i + 1
    endloop
 
    set i = 5
    loop
        exitwhen i > 8
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FFFC01" + GetPlayerName(Player(4)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c00fEBA0E" + GetPlayerName(Player(5)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c0020C000" + GetPlayerName(Player(6)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00E55BB0" + GetPlayerName(Player(7)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(4))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(5))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(6))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(7))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(4))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(4))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(5))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(5))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(6))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(6))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(7))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(7))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelLeft]) )
        set i = i + 1
    endloop

    set i = 1
    loop
        exitwhen i > 8
        if ConvertedPlayer(i) == GetLocalPlayer() then
            call MultiboardDisplayBJ( true, udg_Multiboard[i] )
        endif
        set i = i + 1
    endloop
 
    call StartTimerBJ( udg_IncomeTimer, false, 15.00 )
    call CreateTimerDialogBJ( udg_IncomeTimer, "Income in:" )
    set udg_IncomeWin = GetLastCreatedTimerDialogBJ()
endfunction
//===========================================================================
function InitTrig_Multiboard_Initialization takes nothing returns nothing
    set gg_trg_Multiboard_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Multiboard_Initialization, function Multiboard_Set )
endfunction
For others the display is broken like this:
CtrlV.cz | Nejrychlejší ScreenShot a PrintScreen online
And for red:
CtrlV.cz | Nejrychlejší ScreenShot a PrintScreen online¨

Can you help me fix it? :D
 
Level 9
Joined
Dec 31, 2016
Messages
315
Ok I added set x = 1 inside the first part of the script and suddenly other loops just stopped working and multiboards don't display anymore. What the hell?
JASS:
function Multiboard_Set takes nothing returns nothing
    local integer i = 1
    local integer x = 1
    call TriggerSleepAction( 0.00 )

    loop
        exitwhen i > 8
        set udg_Multiboard[i] = CreateMultiboardBJ( 3, 11, "Overview")
        call MultiboardDisplayBJ( false, udg_Multiboard[i] )
        loop
            exitwhen x > 11
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 2, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 3, x + 1, true, false )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 1, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 2, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 3, x, 6.00 )
            set x = x + 1
        endloop
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 1, 1, "ReplaceableTextures\\CommandButtons\\BTNTemp.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 2, 1, "ReplaceableTextures\\CommandButtons\\BTNChestOfGold.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 3, 1, "ReplaceableTextures\\CommandButtons\\BTNWisp.blp" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 1, "Player" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 1, "Income" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 1, "Lumber" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 7, "Your Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 8, "Enemy Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 10, "Gold in Bank" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 11, "Needed" )
        set x = 1
        set i = i + 1
    endloop
   
    set i = 1
    loop
        exitwhen i > 4
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FF0303" + GetPlayerName(Player(0)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c000042FF" + GetPlayerName(Player(1)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c001CE6B9" + GetPlayerName(Player(2)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00540081" + GetPlayerName(Player(3)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(0))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(1))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(2))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(3))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(0))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(0))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(1))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(1))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(2))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(2))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(3))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(3))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelRight]) )
        set i = i + 1
    endloop
   
    set i = 5
    loop
        exitwhen i > 8
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FFFC01" + GetPlayerName(Player(4)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c00fEBA0E" + GetPlayerName(Player(5)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c0020C000" + GetPlayerName(Player(6)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00E55BB0" + GetPlayerName(Player(7)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(4))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(5))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(6))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(7))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(4))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(4))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(5))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(5))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(6))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(6))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(7))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(7))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelLeft]) )
        set i = i + 1
    endloop

    set i = 1
    loop
        exitwhen i > 8
        if ConvertedPlayer(i) == GetLocalPlayer() then
            call MultiboardDisplayBJ( true, udg_Multiboard[i] )
        endif
        set i = i + 1
    endloop
   
    call StartTimerBJ( udg_IncomeTimer, false, 15.00 )
    call CreateTimerDialogBJ( udg_IncomeTimer, "Income in:" )
    set udg_IncomeWin = GetLastCreatedTimerDialogBJ()
endfunction
//===========================================================================
function InitTrig_Multiboard_Initialization takes nothing returns nothing
    set gg_trg_Multiboard_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Multiboard_Initialization, function Multiboard_Set )
endfunction
 
Level 39
Joined
Feb 27, 2007
Messages
5,015
Is there some kind of limitation to how many lines of code one trigger can handle or what?
Yes but you are absolutely nowhere near the JASS OP limit; that's somewhere in the tens of thousands of executions before a thread crash. You made an error with your MultiboardSetItemStyleBJ() calls where you reference a 12th row of the multiboard that doesn't exist:
JASS:
        loop
            exitwhen x > 11
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 2, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 3, x + 1, true, false )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 1, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 2, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 3, x, 6.00 )
            set x = x + 1
        endloop
when x = 11 the loop runs, but the x+1 makes it try to modify outside the multiboard bounds. Change it to x>=11 or x>10. Check out the function you're calling and you will see what happens if if the row argument is greater than the multiboard's max rows.
JASS:
function MultiboardSetItemStyleBJ takes multiboard mb, integer col, integer row, boolean showValue, boolean showIcon returns nothing
    local integer curRow = 0
    local integer curCol = 0
    local integer numRows = MultiboardGetRowCount(mb)
    local integer numCols = MultiboardGetColumnCount(mb)
    local multiboarditem mbitem = null

   // Loop over rows, using 1-based index
    loop
        set curRow = curRow + 1
        exitwhen curRow > numRows

       // Apply setting to the requested row, or all rows (if row is 0)
        if (row == 0 or row == curRow) then
           // Loop over columns, using 1-based index
            set curCol = 0
            loop
                set curCol = curCol + 1
                exitwhen curCol > numCols

               // Apply setting to the requested column, or all columns (if col is 0)
                if (col == 0 or col == curCol) then
                    set mbitem = MultiboardGetItem(mb, curRow - 1, curCol - 1)
                    call MultiboardSetItemStyle(mbitem, showValue, showIcon)
                    call MultiboardReleaseItem(mbitem)
                endif
            endloop
        endif
    endloop
endfunction
 
Level 9
Joined
Dec 31, 2016
Messages
315
Because I want to show icons in the first row.

Actually, that's not the problem with the x. For the red player the multiboard showed correctly before, but when I added "set x = x + 1" it stopped working after this single line of code was put in.
When I put some debug text it seems like the script just stops working after it executes a set amount of lines. Even when I removed the loop and did it manually, it stoped after executing the exact same amount of lines, I dont understand it.
 
That's a lot of loops, some nested four levels deep.
I suppose this could hit the JASS2 operation limit if you're on an old patch.

Does it work if you sprinkle in some waits to reset the operation counter?
JASS:
function Multiboard_Set takes nothing returns nothing
    local integer i = 1
    local integer x = 1
    call TriggerSleepAction( 0 )

    loop
        exitwhen i > 8
        set udg_Multiboard[i] = CreateMultiboardBJ( 3, 11, "Overview")
        call MultiboardDisplayBJ( false, udg_Multiboard[i] )
        loop
            exitwhen x > 11
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 2, x + 1, true, false )
                call MultiboardSetItemStyleBJ( udg_Multiboard[i], 3, x + 1, true, false )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 1, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 2, x, 6.00 )
                call MultiboardSetItemWidthBJ( udg_Multiboard[i], 3, x, 6.00 )
            set x = x + 1
        endloop
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 1, 1, "ReplaceableTextures\\CommandButtons\\BTNTemp.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 2, 1, "ReplaceableTextures\\CommandButtons\\BTNChestOfGold.blp" )
        call MultiboardSetItemIconBJ( udg_Multiboard[i], 3, 1, "ReplaceableTextures\\CommandButtons\\BTNWisp.blp" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 1, "Player" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 1, "Income" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 1, "Lumber" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 6, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 7, "Your Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 8, "Enemy Level" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 9, "====================" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 10, "Gold in Bank" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 11, "Needed" )
        set x = 1
        set i = i + 1
        call TriggerSleepAction( 0 )
    endloop
  
    set i = 1
    loop
        exitwhen i > 4
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FF0303" + GetPlayerName(Player(0)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c000042FF" + GetPlayerName(Player(1)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c001CE6B9" + GetPlayerName(Player(2)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00540081" + GetPlayerName(Player(3)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(0))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(1))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(2))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(3))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(0))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(0))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(1))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(1))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(2))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(2))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(3))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(3))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelRight]) )
        set i = i + 1
    endloop

    call TriggerSleepAction( 0 )
  
    set i = 5
    loop
        exitwhen i > 8
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 2, "|c00FFFC01" + GetPlayerName(Player(4)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 3, "|c00fEBA0E" + GetPlayerName(Player(5)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 4, "|c0020C000" + GetPlayerName(Player(6)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 1, 5, "|c00E55BB0" + GetPlayerName(Player(7)) + "|r" )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 2, I2S(udg_Income[GetConvertedPlayerId(Player(4))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 3, I2S(udg_Income[GetConvertedPlayerId(Player(5))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 4, I2S(udg_Income[GetConvertedPlayerId(Player(6))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 2, 5, I2S(udg_Income[GetConvertedPlayerId(Player(7))]) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 2, I2S(udg_WispNum[GetConvertedPlayerId(Player(4))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(4))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 3, I2S(udg_WispNum[GetConvertedPlayerId(Player(5))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(5))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 4, I2S(udg_WispNum[GetConvertedPlayerId(Player(6))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(6))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 5, I2S(udg_WispNum[GetConvertedPlayerId(Player(7))]) + "/" + I2S(udg_LumberUp[GetConvertedPlayerId(Player(7))]))
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 7, I2S(udg_LevelLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 8, I2S(udg_LevelRight) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 10, I2S(udg_UpWaveLeft) )
        call MultiboardSetItemValueBJ( udg_Multiboard[i], 3, 11, I2S(udg_NextLevel[udg_LevelLeft]) )
        set i = i + 1
    endloop

    call TriggerSleepAction( 0 )

    set i = 1
    loop
        exitwhen i > 8
        if ConvertedPlayer(i) == GetLocalPlayer() then
            call MultiboardDisplayBJ( true, udg_Multiboard[i] )
        endif
        set i = i + 1
    endloop

    call TriggerSleepAction( 0 )
  
    call StartTimerBJ( udg_IncomeTimer, false, 15.00 )
    call CreateTimerDialogBJ( udg_IncomeTimer, "Income in:" )
    set udg_IncomeWin = GetLastCreatedTimerDialogBJ()
endfunction
//===========================================================================
function InitTrig_Multiboard_Initialization takes nothing returns nothing
    set gg_trg_Multiboard_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Multiboard_Initialization, function Multiboard_Set )
endfunction
 
The problem seems solved with resetting the operation limit?

Still, just a thougt, that in case the trigger runs at map initialization, it may sum up with operations together with other triggers that run in the map at map initialization, too.
All the init triggers will share the same operation thread, and it may be this one suffers of hitting the limit. If this is the case, a wait(0) at very top would do this, too, or just using
the event "Game Time Elapsed - 0 seconds". Becuase intuitively I would think like Pyrogasm, that even there are a lot of BJs, it maybe should not hit the limit alone.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,888
Of course not, the old op limit was 300000, this trigger doesn't even reach 1000. Also, the placement of the 2nd wait function Illidan(evil)X suggests is a no-no as it is delaying the creation for other multiboards. Also, why are you creating 8 multiboards? You only need 2 to do this since it's only 2 teams.
 
Level 39
Joined
Feb 27, 2007
Messages
5,015
Because I want to show icons in the first row.

Actually, that's not the problem with the x.
Yes I was wrong and the issue does seem to be some op limit thing. If the formatting looks fine how it is, whatever, but you've misunderstood me. I'm not saying your set x = x+1 is a problem, I'm saying the "x + 1" in call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false ) is a problem. Your multiboard has 11 rows: <column titles, which have icons>, p1 name, p2 name, p3 name, p4 name, spacer, your level, enemy level, spacer, gold in bank, gold needed. Your loop of x goes from x=1 through x=11, exiting when x=12 because 12>11. If you try to modify the x+1'th row of the multiboard, it will fail when x=11 and the loop runs the final time, because 11+1=12 is outside the multiboard as it is presently defined.

It's also possible I don't know how multiboard icons work and they actually take up a fake extra row that squishes the text on the next row visually onto it. But I don't think I'm wrong here.
 
Level 9
Joined
Dec 31, 2016
Messages
315
Of course not, the old op limit was 300000, this trigger doesn't even reach 1000. Also, the placement of the 2nd wait function Illidan(evil)X suggests is a no-no as it is delaying the creation for other multiboards. Also, why are you creating 8 multiboards? You only need 2 to do this since it's only 2 teams.
You're right, I was thinking about that for some time. Now I realized it's maybe just better to do it this way. :D
Yes I was wrong and the issue does seem to be some op limit thing. If the formatting looks fine how it is, whatever, but you've misunderstood me. I'm not saying your set x = x+1 is a problem, I'm saying the "x + 1" in call MultiboardSetItemStyleBJ( udg_Multiboard[i], 1, x + 1, true, false ) is a problem. Your multiboard has 11 rows: <column titles, which have icons>, p1 name, p2 name, p3 name, p4 name, spacer, your level, enemy level, spacer, gold in bank, gold needed. Your loop of x goes from x=1 through x=11, exiting when x=12 because 12>11. If you try to modify the x+1'th row of the multiboard, it will fail when x=11 and the loop runs the final time, because 11+1=12 is outside the multiboard as it is presently defined.

It's also possible I don't know how multiboard icons work and they actually take up a fake extra row that squishes the text on the next row visually onto it. But I don't think I'm wrong here.
I know what you mean, but it works even with that x +1 inside that function. The issue was probably something about that loop limits.
 
Of course not, the old op limit was 300000, this trigger doesn't even reach 1000.
But it's 300'000 byte code operations, which means it takes similar big amount of operations you would need to write it in machine code -- not the amount of JASS operations. JASS operations' internal amount of used byte code operations may heavily vary.
For example, byte code operations are needed for reading variable values, writing values, arithmetics, creating if/loop structures, calling functions, explicit set-, or return- statements. Also here, 1 outwritten operations would not necessairly mean 1 byte code operation, but it can be more.

The Op Limit - Wc3C.net
 
Status
Not open for further replies.
Top