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

Loop actions inside a loop

Status
Not open for further replies.
Level 5
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 --------
 
Level 9
Joined
Jul 10, 2011
Messages
562
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.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
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.
Top