• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Loop actions inside a loop

Status
Not open for further replies.
Level 6
Joined
Jan 12, 2010
Messages
132
For exe: It doesnt work good.It is wrong to use loop B inside loop B ?

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 8, do (Actions)
            • Loop - Actions
              • Set Integer[1] = (Integer B)
              • For each (Integer B) from 1 to 4, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the text for (Last created multiboard) item in column Integer[1], row 1 to String[(Integer B)]
          • -------- Other types of actions --------
 
afaik you cant loop through integer B inside a integer B loop Oo

i would recommend to use 'for each Integer Variable' loops instead of integer A & B....read somewhere that its better to use it instead of A & B...but i dont remember why.
 
I also recommend you do not use arrays for stuff like "Set Integer[1] = Integer B", use a non-arrayed variable for that. Also do not use arrays for the loop integers.

  • For each (Integer loopInt1) from 1 to 10, do (Actions)
    • Loop - Actions
      • For each (Integer loopInt2) from 1 to 8, do (Actions)
        • Loop - Actions
          • For each (Integer loopInt3) from 1 to 4, do (Actions)
            • Loop - Actions
              • Multiboard - Set the text for (Last created multiboard) item in column loopInt2, row 1 to String[loopInt3]
I don't really see why you need 3 loops for that though.
You basically do the same thing 10 times over, which is a huge waste.
It is possible to remove the first loop and it will work just fine.

claptomanic said:
would recommend to use 'for each Integer Variable' loops instead of integer A & B....read somewhere that its better to use it instead of A & B...but i dont remember why.
I've read that somewhere too, but I really don't see anything really bad about it. They use 2 variables instead of 1, if that would bother you (though those variables have to be initialized anyhow, whether you use them or not).
 
Status
Not open for further replies.
Back
Top