1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Do you have good ideas for new contests? If so, please open new threads in the Contest Submission sub-forum to discuss them.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Multiboard Counter

Discussion in 'Trigger (GUI) Editor Tutorials' started by Squiggy, Dec 30, 2008.

  1. Squiggy

    Squiggy

    Joined:
    Mar 25, 2008
    Messages:
    2,627
    Resources:
    18
    Maps:
    2
    Spells:
    15
    Tutorials:
    1
    Resources:
    18
    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.

      Solution
      • 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:
      Click
      • 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 (Text):
      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: Dec 30, 2008
  2. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Please use

    ,

    , and

    tags.

    EDIT: There. Approved.

     
    Last edited: Dec 30, 2008
  3. Calax1995

    Calax1995

    Joined:
    May 28, 2009
    Messages:
    1
    Resources:
    0
    Resources:
    0
    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! ^^
     
  4. Fredfredburgers

    Fredfredburgers

    Joined:
    Apr 7, 2009
    Messages:
    103
    Resources:
    0
    Resources:
    0
    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
     
  5. Archmage

    Archmage

    Joined:
    Jul 23, 2009
    Messages:
    5
    Resources:
    0
    Resources:
    0
    wow ty this is a very good guide good job m8t : D
     
  6. medion555

    medion555

    Joined:
    Jun 20, 2008
    Messages:
    467
    Resources:
    0
    Resources:
    0
    Help i can only get the two first line of the implant strings
     
  7. Godo

    Godo

    Joined:
    Mar 21, 2010
    Messages:
    6
    Resources:
    0
    Resources:
    0
    sorry, but what does the created multiboard display in the end?