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

[JASS] How to exit loop?

Status
Not open for further replies.
Level 5
Joined
Jun 24, 2012
Messages
112
From what I understand;


I believe you should use OR function, right ?
Either condition should be fine, exit loop either your picked unit has buff, or your Boolean is equal to True.

Or the other way around ?
Both must be true ? (Picked unit has buff + Boolean is True) ?

No, no seperate. Each is for different loops.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So you mean each condition is not meant for each other ?
So this is somewhat 2 separate function, eh ?

If you want to check a certain condition over-time, direct loop is never the answer.

You should use the Event Time - Periodic Event so that you can evaluate the condition each time.

The method you currently used is a direct looping which checks the condition for several times (but in a single period) where you should constantly checking the condition, that's why we use that Event.

Let's say we take a 0.10 second of Periodic Time event.

So, each 0.10 second pass, you make a check, this way you will evaluate those conditions per 0.10 second.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
There is no limit to the number of "exitwhen" clauses a loop can have in WarCraft III.

In programming languages like C this is obtained by using the "break" statement (which JASS does not have). The use is to allow early exits from complex loops without having to reach the end.

In simple loops you can often tie the logic together using the logical "and" and "or" operators.
 
Status
Not open for further replies.
Top