- Joined
- Jun 26, 2020
- Messages
- 1,928
I have a trigger to create a multiboard:
But I passed it to Jass:
I remade the BJs functions because they have a reference leak and to reduce the number of steps and adding an exception
But now the multiboard doesn't display properly
Before:
Now:
What is happening?
-
Tabla
-
Events
-
Conditions
-
Actions
-
Set Grupo_Jugador_Variable[3] = (All players matching (((Matching player) slot status) Equal to Is playing))
-
Multiboard - Create a multiboard with 5 columns and (1 + (Number of players in Grupo_Jugador_Variable[3])) rows, titled Statistics
-
Custom script: call DestroyForce(udg_Grupo_Jugador_Variable[3])
-
Set Tabla = (Last created multiboard)
-
Multiboard - Hide Tabla
-
Multiboard - Set the width for Tabla item in column 1, row 0 to 1.45% of the total screen width
-
Multiboard - Set the width for Tabla item in column 2, row 0 to 6.50% of the total screen width
-
Multiboard - Set the display style for Tabla item in column 0, row 0 to Show text and Hide icons
-
Multiboard - Set the text for Tabla item in column 0, row 0 to 0
-
Multiboard - Set the text for Tabla item in column 1, row 0 to <Empty string>
-
Multiboard - Set the text for Tabla item in column 0, row 2 to <Empty string>
-
Multiboard - Set the text for Tabla item in column 1, row 2 to |cffff0000Drae|r
-
Multiboard - Set the text for Tabla item in column 2, row 2 to |cffff0000 nei|r
-
Multiboard - Set the text for Tabla item in column 2, row 1 to Player
-
Multiboard - Set the text for Tabla item in column 3, row 1 to Kills
-
Multiboard - Set the text for Tabla item in column 4, row 1 to Deaths
-
Multiboard - Set the text for Tabla item in column 5, row 1 to Assists
-
Multiboard - Set the color for Tabla item in column 0, row 0 to (41.00%, 41.00%, 41.00%) with 0.00% transparency
-
Multiboard - Set the color for Tabla item in column 0, row 1 to (100.00%, 83.00%, 0.00%) with 0.00% transparency
-
Trigger - Run Jugadores Orden <gen> (checking conditions)
-
Multiboard - Mostrar Tabla
-
Multiboard - Maximizar Tabla
-
-
JASS:
function IsPlaying takes nothing returns boolean
return GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING
endfunction
function Trig_Tabla_Actions takes nothing returns nothing
local force f=GetPlayersMatching(Condition(function IsPlaying))
set udg_Row[0]=100
set udg_Tabla=CreateMultiboard()
call MultiboardSetColumnCount(udg_Tabla,5)
call MultiboardSetRowCount(udg_Tabla,1+CountPlayersInForceBJ(f))
call MultiboardSetTitleText(udg_Tabla,"Statistics")
call DestroyForce(f)
call MultiboardDisplay(udg_Tabla,false)
call MultiboardSetItemWidthMejor(udg_Tabla,1,0,1.45/100)
call MultiboardSetItemWidthMejor(udg_Tabla,2,0,6.50/100)
call MultiboardSetItemStyleMejor(udg_Tabla,0,0,true,false)
call MultiboardSetItemValueMejor(udg_Tabla,0,0,"0")
call MultiboardSetItemValueMejor(udg_Tabla,1,0,"")
call MultiboardSetItemValueMejor(udg_Tabla,0,2,"")
call MultiboardSetItemValueMejor(udg_Tabla,1,2,"|cffff0000Drae|r")
call MultiboardSetItemValueMejor(udg_Tabla,2,2,"|cffff0000 nei|r")
call MultiboardSetItemValueMejor(udg_Tabla,2,1,"Player")
call MultiboardSetItemValueMejor(udg_Tabla,3,1,"Kills")
call MultiboardSetItemValueMejor(udg_Tabla,4,1,"Deaths")
call MultiboardSetItemValueMejor(udg_Tabla,5,1,"Assists")
call MultiboardSetItemColorMejor(udg_Tabla,0,0,105,105,105,255)
call MultiboardSetItemColorMejor(udg_Tabla,0,1,255,212,0,255)
call ConditionalTriggerExecute(gg_trg_Jugadores_Orden)
endfunction
//===========================================================================
function InitTrig_Tabla takes nothing returns nothing
set gg_trg_Tabla=CreateTrigger()
call TriggerAddAction(gg_trg_Tabla,function Trig_Tabla_Actions)
endfunction
JASS:
function MultiboardSetItemValueMejor takes multiboard mb, integer col, integer row, string val returns nothing
local integer curRow
local integer curCol
local integer numRows
local integer numCols
local multiboarditem mbitem=null
if row-1>MultiboardGetRowCount(mb) or col-1>MultiboardGetColumnCount(mb) or row<0 or col<0 then
return
endif
if row==0 then
set numRows=MultiboardGetRowCount(mb)
set curRow=0
else
set numRows=row-1
set curRow=row-1
endif
if col==0 then
set numCols=MultiboardGetColumnCount(mb)
set curCol=0
else
set numCols=col-1
set curCol=col-1
endif
loop
exitwhen curRow>numRows
set curCol=0
loop
exitwhen curCol>numCols
set mbitem=MultiboardGetItem(mb,curRow,curCol)
call MultiboardSetItemValue(mbitem,val)
call MultiboardReleaseItem(mbitem)
set curCol=curCol+1
endloop
set curRow=curRow+1
endloop
set mbitem=null
endfunction
function MultiboardSetItemIconMejor takes multiboard mb, integer col, integer row, string myitem returns nothing
local integer curRow
local integer curCol
local integer numRows
local integer numCols
local multiboarditem mbitem=null
if row-1>MultiboardGetRowCount(mb) or col-1>MultiboardGetColumnCount(mb) or row<0 or col<0 then
return
endif
if row==0 then
set numRows=MultiboardGetRowCount(mb)
set curRow=0
else
set numRows=row-1
set curRow=row-1
endif
if col==0 then
set numCols=MultiboardGetColumnCount(mb)
set curCol=0
else
set numCols=col-1
set curCol=col-1
endif
loop
exitwhen curRow>numRows
set curCol=0
loop
exitwhen curCol>numCols
set mbitem=MultiboardGetItem(mb,curRow,curCol)
call MultiboardSetItemIcon(mbitem,myitem)
call MultiboardReleaseItem(mbitem)
set curCol=curCol+1
endloop
set curRow=curRow+1
endloop
set mbitem=null
endfunction
function MultiboardSetItemStyleMejor takes multiboard mb, integer col, integer row, boolean showValue, boolean showIcon returns nothing
local integer curRow
local integer curCol
local integer numRows
local integer numCols
local multiboarditem mbitem=null
if row-1>MultiboardGetRowCount(mb) or col-1>MultiboardGetColumnCount(mb) or row<0 or col<0 then
return
endif
if row==0 then
set numRows=MultiboardGetRowCount(mb)
set curRow=0
else
set numRows=row-1
set curRow=row-1
endif
if col==0 then
set numCols=MultiboardGetColumnCount(mb)
set curCol=0
else
set numCols=col-1
set curCol=col-1
endif
loop
exitwhen curRow>numRows
set curCol=0
loop
exitwhen curCol>numCols
set mbitem=MultiboardGetItem(mb,curRow,curCol)
call MultiboardSetItemStyle(mbitem,showValue,showIcon)
call MultiboardReleaseItem(mbitem)
set curCol=curCol+1
endloop
set curRow=curRow+1
endloop
set mbitem=null
endfunction
function MultiboardSetItemWidthMejor takes multiboard mb, integer col, integer row, real width returns nothing
local integer curRow
local integer curCol
local integer numRows
local integer numCols
local multiboarditem mbitem=null
if row-1>MultiboardGetRowCount(mb) or col-1>MultiboardGetColumnCount(mb) or row<0 or col<0 then
return
endif
if row==0 then
set numRows=MultiboardGetRowCount(mb)
set curRow=0
else
set numRows=row-1
set curRow=row-1
endif
if col==0 then
set numCols=MultiboardGetColumnCount(mb)
set curCol=0
else
set numCols=col-1
set curCol=col-1
endif
loop
exitwhen curRow>numRows
set curCol=0
loop
exitwhen curCol>numCols
set mbitem=MultiboardGetItem(mb,curRow,curCol)
call MultiboardSetItemWidth(mbitem,width)
call MultiboardReleaseItem(mbitem)
set curCol=curCol+1
endloop
set curRow=curRow+1
endloop
set mbitem=null
endfunction
function MultiboardSetItemColorMejor takes multiboard mb, integer col, integer row, integer red, integer green, integer blue, integer alpha returns nothing
local integer curRow
local integer curCol
local integer numRows
local integer numCols
local multiboarditem mbitem=null
if row-1>MultiboardGetRowCount(mb) or col-1>MultiboardGetColumnCount(mb) or row<0 or col<0 then
return
endif
if row==0 then
set numRows=MultiboardGetRowCount(mb)
set curRow=0
else
set numRows=row-1
set curRow=row-1
endif
if col==0 then
set numCols=MultiboardGetColumnCount(mb)
set curCol=0
else
set numCols=col-1
set curCol=col-1
endif
loop
exitwhen curRow>numRows
set curCol=0
loop
exitwhen curCol>numCols
set mbitem=MultiboardGetItem(mb,curRow,curCol)
call MultiboardSetItemValueColor(mbitem,red,green,blue,alpha)
call MultiboardReleaseItem(mbitem)
set curCol=curCol+1
endloop
set curRow=curRow+1
endloop
set mbitem=null
endfunction
Before:
Now:
What is happening?
Last edited: