| 02-19-2007, 12:27 AM | #1 |
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. 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 |
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 |
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 |
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 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, 10:06 PM | #6 |
That multiboard looks exactly like dotas... |
