CBA_fnc_waitUntilAndExecute

Description

Executes a code once in unscheduled environment after a condition is true.  It’s also possible to add a timeout >= 0, in which case a different code is executed.  Then it will be waited until _timeout time has elapsed or _condition evaluates to true.

Parameters

_conditionThe function to evaluate as condition.  <CODE>
_statementThe function to run if the condition is true before timeout.  <CODE>
_argsParameters passed to the functions (statement and condition) executing.  (optional) <ANY>
_timeoutIf >= 0, timeout for the condition in seconds.  If < 0, no timeout.  Exactly 0 means timeout immediately on the next iteration.(optional, default -1) <NUMBER>
_timeoutCodeWhen provided, will be executed if condition times out.  (optional) <CODE>

Passed Arguments

_thisParameters passed by this function.  Same as ‘_args’ above.  <ANY>

Returns

Nothing

Examples

[{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [player]] call CBA_fnc_waitUntilAndExecute;
[{backpackCargo _this isEqualTo []}, {
    deleteVehicle _this;
}, _holder, 5, {hint backpackCargo _this;}] call CBA_fnc_waitUntilAndExecute;

Author

joko // Jonas, donated from ACE3

Close