• 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.

Question on Integers A and B

Status
Not open for further replies.
Level 5
Joined
Aug 3, 2005
Messages
70
This may seem like a silly question, but I was wondering what use these functions have and/or what they do.
Are integers A and B simply variable integers but defined within the trigger?
Or am I not even in the ballpark with that? <.<

Anyone able to shed some light on these and/or point me in the right direction to finding said light? I've always wondered what these were and how to use them, but have been hard pressed to find anything definite on it. Maybe I'm not looking hard enough :sad:
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
An Integer A/B is indeed a bit of a confusing name. What it actually does is repeat everything in the loop for X times, where X is what you enter in the Integer A/B command. Here's an example:

  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • Game - Display to (All players) the text: (String((Integer A)))
This means it will do everything over and over again and fill in Integer A for the next number in line. In this example, the command to display text will be done 5 times (from 1 to 5). So if we would write this out without Integer A command, we would get:

  • Game - Display to (All players) the text: 1
  • Game - Display to (All players) the text: 2
  • Game - Display to (All players) the text: 3
  • Game - Display to (All players) the text: 4
  • Game - Display to (All players) the text: 5
So to make a conclusion: Integer A/B does everything in the loop with the first number, then does it again with the next number, then again with the next, etc. This is very useful for entering a formula or if you need to repeat something for a variable with like 100 arrays. Instead of saying Set Counter[1] = On, Set Counter[2] = On, Set Counter[3] = On, etc for 100 counters, you can just make 1 Integer A/B command

  • For each (Integer A) from 1 to 100, do (Actions)
    • Loop - Actions
      • Set Counter[(Integer A)] = On
and you're done!


Keep in mind that there's a known problem with overusing 1 Integer X. It will not work correctly anymore. So vary the use of Integer A with Integer B and others.
 
Status
Not open for further replies.
Top