From Bohemia Interactive Community
Notes
- Posted on September 20, 2013
- Killzone_Kid
- In case you have more complex code inside waitUntil loop, to be on the safe side always return boolean at the end of the scope:
player addEventHandler ["Fired", {
_null = (_this select 6) spawn {
_p = [0,0,0];
waitUntil {
if (isNull _this) exitWith {true};
_p = getPos _this;
false //<-- boolean at the end of the scope NOW REQUIRED
};
hint str _p;
};
}];
- Posted on December 20, 2006 - 19:55
- CrashDome
-
waitUntil suspends both SQF functions and SQF scripts. In functions, the calling script is still in suspension due to waiting for a return from the call command. The game engine will continue, however. See Function for more detail.
- Posted on April 2, 2010 - 17:10
- Roehre
-
Prior to Arma 3 v1.92.145618 if WaitUntil uses an undefined call code, WaitUntil won't release, even when this code is separated from other conditions through or. Be warned that this won't cause an error message.
- Posted on Jan 07, 2011
- kju
-
By default the cycle time for the condition check is per frame. Look at the example 3, how to set it at a lower rate yourself.
Often times one does not need per frame checking. Saves a lot CPU checks; especially when the condition is complex to compute.
Bottom Section
- Posted on December 13, 2014 - 23:25 (UTC)
- Commy2
-
If you want to use waitUntil together with exitWith, remember that the loop only exits if the code block returns true.
It should look like this:
waitUntil {
// exit loop if the unit gets deleted
if (isNull _unit) exitWith {true}; // has to return true to continue
!alive _unit;
};