• 🏆 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!

Multiboard Optimizations?

Status
Not open for further replies.
Level 4
Joined
Sep 18, 2007
Messages
104
I was just wondering if these were the most efficient ways of making and updating a multiboard in GUI, but just so you know I can do a little JASS(still learning) so I guess you can answer in JASS if you want to, just not vJASS.

NOTE: This is not the map that the multiboard was going to be put into, just a map to trigger and test the multiboard.

  • SETUP
  • Events
    • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 11, do (Actions)
        • Loop - Actions
          • Multiboard - Create a multiboard with 2 columns and 6 rows, titled Info
          • Set Multiboard[(Integer A)] = (Last created multiboard)
          • Multiboard - Hide Multiboard[(Integer A)]
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 1 to Time:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 2 to Reinforcements:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 3 to Level:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 2, row 3 to (String(1))
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 4 to Revive:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 2, row 4 to --
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 5 to Kills:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 2, row 5 to (String(0))
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 1, row 6 to Morale:
          • Multiboard - Set the text for Multiboard[(Integer A)] item in column 2, row 6 to (String((Player 1 (Red) Current lumber)))
          • Multiboard - Set the width for Multiboard[(Integer A)] item in column 0, row 0 to 10.00% of the total screen width
          • Multiboard - Set the display style for Multiboard[(Integer A)] item in column 0, row 0 to Show text and Hide icons
          • Multiboard - Show Multiboard[(Integer A)]
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: if ( GetLocalPlayer() == GetEnumPlayer() ) then
          • Custom script: call MultiboardDisplay(udg_Multiboard[GetPlayerId(GetEnumPlayer())], true)
          • Custom script: endif
      • Countdown Timer - Start Timer[0] as a Repeating timer that will expire in 60.00 seconds
  • Multiboard Countup
    • Events
    • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set ElapsedSec = (ElapsedSec + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ElapsedHour Less than 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ElapsedSec Less than 10
            • Then - Actions
              • Multiboard - Set the text for Multiboard[0] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[2] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[3] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[4] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[5] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[6] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[7] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[8] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[9] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[10] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[11] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (0 + (String(ElapsedSec))))
            • Else - Actions
              • Multiboard - Set the text for Multiboard[0] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[2] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[3] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[4] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[5] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[6] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[7] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[8] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[9] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[10] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[11] item in column 2, row 1 to (((String(ElapsedMin)) + :) + (String(ElapsedSec)))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ElapsedSec Less than 10
            • Then - Actions
              • Multiboard - Set the text for Multiboard[0] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[2] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[3] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[4] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[5] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[6] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[7] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[8] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[9] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[10] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
              • Multiboard - Set the text for Multiboard[11] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (0 + (String(ElapsedSec))))
            • Else - Actions
              • Multiboard - Set the text for Multiboard[0] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[2] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[3] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[4] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[5] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[6] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[7] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[8] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[9] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[10] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
              • Multiboard - Set the text for Multiboard[11] item in column 2, row 1 to ((((String(ElapsedHour)) + :) + ((String(ElapsedMin)) + :)) + (String(ElapsedSec)))
  • CountUpMin
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set ElapsedMin = (ElapsedMin + 1)
      • Set ElapsedSec = 0
  • CountUpHour
    • Events
      • Time - Every 3600.00 seconds of game time
    • Conditions
    • Actions
      • Set ElapsedMin = 0
      • Set ElapsedHour = (ElapsedHour + 1)
      • Multiboard - Set the text for Multiboard[0] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[2] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[3] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[4] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[5] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[6] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[7] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[8] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[9] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[10] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
      • Multiboard - Set the text for Multiboard[11] item in column 2, row 1 to (((String(ElapsedHour)) + :) + (((String(ElapsedMin)) + :) + (String(ElapsedSec))))
  • Multiboard Countdown
    • Events
    • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Countdown = (Integer((Remaining time for Timer[0])))
      • Multiboard - Set the text for Multiboard[0] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[1] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[2] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[3] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[4] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[5] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[6] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[7] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[8] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[9] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[10] item in column 2, row 2 to (String(Countdown))
      • Multiboard - Set the text for Multiboard[11] item in column 2, row 2 to (String(Countdown))
  • Start Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Countdown Timer - Start Timer[(Integer((Name of (Owner of (Dying unit)))))] as a One-shot timer that will expire in 30.00 seconds
      • Trigger - Turn on Hero Timer <gen>
      • Multiboard - Set the text for Multiboard[((Player number of (Owner of (Dying unit))) - 1)] item in column 2, row 4 to (String((Remaining time for Timer[(Integer((Name of (Owner of (Dying unit)))))])))
      • Wait until ((Integer((Remaining time for Timer[(Integer((Name of (Owner of (Dying unit)))))]))) Less than or equal to 0), checking every 10.00 seconds
      • Hero - Instantly revive (Dying unit) at (Player 1 (Red) start location), Show revival graphics
      • Multiboard - Set the text for Multiboard[((Player number of (Owner of (Dying unit))) - 1)] item in column 2, row 4 to --
      • Trigger - Turn off Hero Timer <gen>
  • Hero Timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Multiboard - Set the text for Multiboard[(Integer A)] item in column 2, row 4 to (String((Remaining time for Timer[(Integer A)])))
  • Level
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Leveling Hero) is A Hero) Equal to True
    • Actions
      • Multiboard - Set the text for Multiboard[((Player number of (Owner of (Leveling Hero))) - 1)] item in column 2, row 3 to (String((Hero level of (Leveling Hero))))
  • Kills
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Multiboard - Set the text for Multiboard[((Player number of (Owner of (Killing unit))) - 1)] item in column 2, row 5 to (String(((Owner of (Killing unit)) Units Killed)))
      • Player - Add 1 to (Owner of (Killing unit)) Current lumber
  • Morale
    • Events
      • Player - Player 1 (Red)'s Current lumber becomes Greater than or equal to (Real((Player 7 (Green) Current lumber)))
      • Player - Player 7 (Green)'s Current lumber becomes Greater than or equal to (Real((Player 1 (Red) Current lumber)))
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 11, do (Actions)
        • Loop - Actions
          • Multiboard - Set the text for Multiboard[0] item in column 2, row 6 to (String((Player 1 (Red) Current lumber)))
          • Multiboard - Set the text for Multiboard[1] item in column 2, row 6 to (String((Player 2 (Blue) Current lumber)))
          • Multiboard - Set the text for Multiboard[2] item in column 2, row 6 to (String((Player 3 (Teal) Current lumber)))
          • Multiboard - Set the text for Multiboard[3] item in column 2, row 6 to (String((Player 4 (Purple) Current lumber)))
          • Multiboard - Set the text for Multiboard[4] item in column 2, row 6 to (String((Player 5 (Yellow) Current lumber)))
          • Multiboard - Set the text for Multiboard[5] item in column 2, row 6 to (String((Player 6 (Orange) Current lumber)))
          • Multiboard - Set the text for Multiboard[6] item in column 2, row 6 to (String((Player 7 (Green) Current lumber)))
          • Multiboard - Set the text for Multiboard[7] item in column 2, row 6 to (String((Player 8 (Pink) Current lumber)))
          • Multiboard - Set the text for Multiboard[8] item in column 2, row 6 to (String((Player 9 (Gray) Current lumber)))
          • Multiboard - Set the text for Multiboard[9] item in column 2, row 6 to (String((Player 10 (Light Blue) Current lumber)))
          • Multiboard - Set the text for Multiboard[10] item in column 2, row 6 to (String((Player 11 (Dark Green) Current lumber)))
          • Multiboard - Set the text for Multiboard[11] item in column 2, row 6 to (String((Player 12 (Brown) Current lumber)))
I know that the Game Time Elapsed and the Countdown times are off, but right now I can't seem to get that completely accurate.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Eleandor, the reason that people think you have to use BJs for multiboards is that they never actually read the BJs; they just look at them, see how long they are, and don't notice just why they're so long.

Here's that first trigger again in Jass. Not including slowness due to BJs, this should already be several times faster than the GUI alternative;

JASS:
function Setup takes nothing returns nothing
    local multiboard mb
    local integer i = 0
    loop
        exitwhen i > 11
        set mb = CreateMultiboard()
        set udg_Multiboard[i] = mb
        call MultiboardSetRowCount(mb,6)
        call MultiboardSetColumnCount(mb,2)
        call MultiboardSetTitleText(mb,"Info")
        call MultiboardSetItemsStyle(mb,true,false)
        call MultiboardSetItemsWidth(mb,.10)
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,0),"Time:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,1),"Reinforcements:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,2),"Level:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,3),"Revive:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,4),"Kills:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,0,5),"Morale:")
        call MultiboardSetItemValue(MultiboardGetItem(mb,1,2),"1")
        call MultiboardSetItemValue(MultiboardGetItem(mb,1,3),"--")
        call MultiboardSetItemValue(MultiboardGetItem(mb,1,4),"0")
        call MultiboardSetItemValue(MultiboardGetItem(mb,1,5),I2S(GetPlayerState(Player(i),PLAYER_STATE_RESOURCE_LUMBER)))
        if GetLocalPlayer() == Player(i) then
            call MultiboardDisplay(mb,true)
        endif
        set i = i + 1
    endloop
    call DestroyTimer(GetExpiredTimer())
endfunction

function InitTrig_Setup takes nothing returns nothing
    call TimerStart(CreateTimer(),.5,false,function Setup)
endfunction
 
Level 4
Joined
Sep 18, 2007
Messages
104
Ok thanks for the replies, but are those triggers the most efficient ways of doing multiboards? I mean like the loops/if then elses. In some of the triggers like Countdown for example, I don't use loops there, would it be better to use a loop every second or just keep it the way it is. Sorry, this is my first multiboard. Also I was wondering if I should of just started the timer when making the multiboard, as I think that was what you did.
 
Level 4
Joined
Sep 18, 2007
Messages
104
Really the only problem I am having is the revive trigger(s), I just can't think of a way of how to do that and not having it display on everyone else's multiboard.

Actually I plan on making this JASS when i'm done fixing it, just that it's easier for me to edit in GUI first. I will just convert than replace BJ's with natives.Then I will implement into map. Also I updated first post to show what my triggers are for the moment.
 
Status
Not open for further replies.
Top