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

[Trigger] Checking for first True or False boolean

Status
Not open for further replies.
Level 18
Joined
Aug 23, 2008
Messages
2,319
I got a boolean variable with a bunch of arrays and I'd like to know if it's possible to check which of the array's is the first on a row to be True or False.

Example:

Boolean[1] = False
Boolean[2] = False
Boolean[3] = False
Boolean[4] = False
Boolean[5] = False
Boolean[6] = False
Boolean[7] = False
Boolean[8] = False
Boolean[9] = False
Boolean[10] = False
Boolean[11] = True
Boolean[12] = True
Boolean[13] = True
Boolean[14] = True
Boolean[15] = True
Boolean[16] = True
Boolean[17] = True
Boolean[18] = True
Boolean[19] = True
Boolean[20] = True

In this example, I want to check for Boolean[11] only. Boolean 12 and higher should not be effected.

I was thinking about a Integer A loop, but I don't know how I should only check for the first that passes the 'test'.
 
Level 9
Joined
May 27, 2006
Messages
498
  • For each (Integer A) from 1 to 20 do (Actions):
    • Custom script: exitwhen udg_Boolean[(GetForLoop(Integer A))] = true
    • If/Then/Else - Multiple functions:
      • If - Conditions:
        • Boolean[(Integer A)] = true
      • Then - Actions:
        • Do blah
      • Else - Actions:
Integer A strikes again... :p

Actually, i'm not sure if this will work, im not used to Jass, and dont have WE to test it. Just remember to save everything in case it crashes your warcraft D: If so, then just remove the script and add Skip remaining actions at the end of the then actions. The only problem is that you'll have to place the if/then/else block at the end of your trigger, as the skip remaining actions action skip everything after it...
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Skip Remaining Actions would cause the entire rest of my trigger to turn off, which isn't very useful.

Thank you both raft_pl and HappyTauren for your solutions. Since I'm not entirely sure if my trigger will work correctly, do you mind if I'll place that part of the trigger here once I finished it and could you check if it would work correctly if you'd look at it? You don't need to test it, since I can't test it either unless I make a big bunch of other triggers or else I'll have to edit a lot, which screws up a lot of work.
 
Level 9
Joined
May 27, 2006
Messages
498
Skip remaining actions does the exact thing as its stated in its name - it skips all the other actions after it, even those outside if/then/else blocks/loops. Thats why exitwhen would be a better solution.
Dang.

Of course we could check it, but i won't be able to do that for the next two weeks, cause i don't have my comp for that time...
 
Level 11
Joined
Dec 31, 2007
Messages
780
actually... once your boolean is true you can make the trigger to run another trigger with all of your coding in there... and that would let you use "skip remaining actions" after "run X trigger"

EDIT: as we posted at the same time i didnt read you in time... im not saying the jass sentence isn't better that skip remaining actions... but maybe easier to apply for a gui guy :p
 
Status
Not open for further replies.
Top