• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Multiboard Counter

Level 28
Joined
Mar 25, 2008
Messages
2,955
Hi,
today we'll do a simple

Multiboard counter

.
(difficulty: 2/10)

-----------------------------

We need:
  1. medium knowledge about variables
  2. an existing multiboard
  3. three (six) integer variables
  4. GUI
That's it.

-----------------------------

  1. The Set-up:

    Open your Triggers-Editor, and click on the 'x' stating 'variables (or press CTRL + X, as you want to create a new one.
    Now you create a new variable of the type integer, name it whatever (it's gonna be our seconds-integer).
    After, create one more for the minutes and a third one for the hours.Now - I did it with arrays of size 2 - but you also can use another variable (makes two for seconds, two for minutes and two for the hours, they way it's done is pretty the same.​
  2. The trigger itself

    Alright, now create a new trigger and give it the event:
    • Time - Every 1.00 seconds of game time
    Leave the conditions blank if you want.
    We're gonna do this using the arrayed variables, so read carefully now.
    I named my integer for the seconds 'ints[]', for the minutes 'intm[]' and for the hours 'inth[]'.
    As we want to make the counter look pretty, we do it like this:
    Inth[] : intm[] : ints[]
    You might know that if an integer is of the value 0, it will show 0 ingame.
    But you might want 00:00:00 - that's where we need the arrays come in (or the second variables of each type).
    Now, we set it up as follows:
    • Actions
      • Set ints[0] = (ints[0] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ints[0] Equal to 10
        • Then - Actions
          • Set ints[0] = 0
          • Set ints[1] = (ints[1] + 1)
        • Else - Actions
    The first 'Set ints[0] =' increases the counter by +01.
    The 'Set ints[1] =' increases the counter by +10.
    It sounds more complicated than it is.
    Basically, every second, int[0] is increased.
    When int[0] reaches the value '10', (means after ten seconds), int[1] is increased by 1 and int[0] being reset to 0.

    Next for the minutes:
    We want to change the integer for the minutes to increase by 1 if the seconds reach 60, that's clear.

    Now, the trigger-part looks like that
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ints[1] Equal to 6
      • Then Actions
        • Set ints[0] = 0
        • Set ints[1] = 0
        • Set intm[0] = (intm[0] + 1)
      • Else - Actions
    It states that whenever ints[1] reaches 6 (means that we have 60 seconds now), the integer for the minutes is raised by 1.

    Now for a better understanding, do it yourself for the minutes and hours:
    Set the variables correctly so the intm[1] is raised by 1 every ten minutes and if the integer reaches 6, reset all values but increase the values for the hours by one.

    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • intm[0] Equal to 10
      • Then - Actions
        • Set ints[0] = 0
        • Set ints[1] = 0
        • Set intm[0] = 0
        • Set intm[1] = (intm[1] + 1)
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • intm[1] Equal to 6
      • Then - Actions
        • Set ints[0] = 0
        • Set ints[1] = 0
        • Set intm[0] = 0
        • Set intm[1] = 0
        • Set inth[0] = (inth[0] + 1)
      • Else - Actions


    Our whole trigger now looks somewhat like this:
    • Actions
      • Set ints[0] = (ints[0] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ints[0] Equal to 10
        • Then - Actions
          • Set ints[0] = 0
          • Set ints[1] = (ints[1] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ints[1] Equal to 6
        • Then Actions
          • Set ints[0] = 0
          • Set ints[1] = 0
          • Set intm[0] = (intm[0] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • intm[0] Equal to 10
        • Then - Actions
          • Set ints[0] = 0
          • Set ints[1] = 0
          • Set intm[0] = 0
          • Set intm[1] = (intm[1] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • intm[1] Equal to 6
        • Then - Actions
          • Set ints[0] = 0
          • Set ints[1] = 0
          • Set intm[0] = 0
          • Set intm[1] = 0
          • Set inth[0] = (inth[0] + 1)
        • Else - Actions
    Feel free to do the same for inth[1] but I didn't expect any map to take longer than ten hours (unless it's a campaign..)
  3. The Multiboard-implementation

    Last thing is to put it right into your multiboard.
    This is pretty easy too, you just need a bunch of strings.

    The actual multiboard will look like:
    Code:
    inth[1] inth[0] : intm[1]  intm[0] : ints[1] ints[0]
      0        0    :    0        0    :    0      0

    For the actual action, just don't forget to leave spaces between the :

    • Multiboard - Set the text for (Last created multiboard) item in column x, row y to ((((String(inth[1])) + (String(inth[0]))) + :) + (((String(intm[1])) + (String(intm[0]))) + (: + ((String(ints[1])) + (String(ints[0]))))))
Right, we're finished.

-----------------------------

Conclusion:

ints[0] will change every second
ints[1] will change every ten seconds
intm[0] will change every 60 seconds
intm[1] will change every 600 seconds (ten minutes)
inth[0] will change every 3600 seconds (one hour)
(inth[1] will change every 36000 seconds (every ten hours))

Have fun ;)
 
Last edited by a moderator:
Level 1
Joined
May 28, 2009
Messages
1
Hmm i whoud gladly say it´s nice to see a tutorial like this up... But it was hard to understand it...
And the last box is very hard readable so i didnt manage to fix the strings.

I whoud be very thankful if you coud take your time and fix this!

Thanks on advice! ^^
 
Level 4
Joined
Apr 7, 2009
Messages
108
i got it,
you put clock on bottom right or top right,(my multiboard it 4 columns, 14 rows)
and here is my action
  • Keep Up Clock
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- Clock --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Multiboard - Set the text for Multiboard item in column 4, row 14 to (((((String(ClockTH)) + (String(ClockH))) + : ) + (String(ClockTM))) + ((String(ClockM)) + ( : + ((String(ClockTS)) + (String(ClockS))))))
        • Else - Actions
          • -------- I will break it down for you all... --------
          • -------- go to Multiboard-Set Item Text --------
          • -------- go to Multiboard-Set Item Text --------
          • -------- Then you got red "Text" --------
          • -------- Click it and you will have red String + String --------
          • -------- Click Left one 4 times, always one of left and set that for inth[1] by Conversion from Integer to String --------
          • -------- Hit Enter then you have inth[1] + String --------
          • -------- Click String and do Conversion Integer to String for inth[0] --------
          • -------- Hit Enter and you got ((String(inth[1]) + (String(inth[0])) + String --------
          • -------- Click the String and enter Value " : " (space semicolon space) --------
          • -------- Hit enter then you got (((String(inth[1]) + (String(inth[0])) + : ) + String --------
          • -------- Click String and Conversion Integer to String for intm[1] and hit enter --------
          • -------- then you got ((((String(inth[1]) + (String(inth[0])) + : ) + (String(intm[1])) + String --------
          • -------- now you hit right string 4 times, the string always on the right --------
          • -------- then do conversion integer to string for ints[0] --------
          • -------- hit enter and left string do conversion integer to string for ints[1] --------
          • -------- hit enter and you should have String + ((String(ints[1]) + (String(ints[0]))) --------
          • -------- click string and enter value " : " then you should have --------
          • -------- (( : ) + ((String(ints[1]) + (String(ints[0])))) --------
          • -------- hit enter and you will have String + (( : ) + ((String(ints[1]) + (String(ints[0])))) --------
          • -------- hit string and do conversion integer to string for intm[0] --------
          • -------- hit enter many timex until your have a result like mine --------
Key:
ClockS = ints[0]
ClockTS = ints[1]
ClockM = intm[0]
ClockTM = intm[1]
ClockH = inth[0]
ClockTH = inth[1]

good luck on your multiboards and games
 
Top