From 52a72103e9fca13cfd189f645dddbe30baf840fd Mon Sep 17 00:00:00 2001 From: Felix Linker Date: Sat, 21 Apr 2018 00:33:13 +0200 Subject: [PATCH 1/3] fnc_waitUntilAndExecute now can timeout for 0s References #910 --- addons/common/fnc_waitUntilAndExecute.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/fnc_waitUntilAndExecute.sqf b/addons/common/fnc_waitUntilAndExecute.sqf index 9c0c6ac80..2dc41cdf6 100644 --- a/addons/common/fnc_waitUntilAndExecute.sqf +++ b/addons/common/fnc_waitUntilAndExecute.sqf @@ -37,11 +37,11 @@ params [ ["_condition", {}, [{}]], ["_statement", {}, [{}]], ["_args", []], - ["_timeout", 0, [0]], + ["_timeout", -1, [0]], ["_timeoutCode", {}, [{}]] ]; -if (_timeout == 0) then { +if (_timeout < 0) then { GVAR(waitUntilAndExecArray) pushBack [_condition, _statement, _args]; } else { GVAR(waitUntilAndExecArray) pushBack [{ From 449a7dbedf344d7d39875e7be4810a9980e77016 Mon Sep 17 00:00:00 2001 From: Felix Linker Date: Sat, 21 Apr 2018 11:02:44 +0200 Subject: [PATCH 2/3] CBA_fnc_waitUntilAndExecute documentation added --- addons/common/fnc_waitUntilAndExecute.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/common/fnc_waitUntilAndExecute.sqf b/addons/common/fnc_waitUntilAndExecute.sqf index 2dc41cdf6..7e7052c94 100644 --- a/addons/common/fnc_waitUntilAndExecute.sqf +++ b/addons/common/fnc_waitUntilAndExecute.sqf @@ -3,7 +3,8 @@ Function: CBA_fnc_waitUntilAndExecute Description: Executes a code once in unscheduled environment after a condition is true. - It's also possible to add a timeout, in which case a different code is executed. + 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: _condition - The function to evaluate as condition. From 92a9619fc9bce0c02b9b312c178d5495d25cc611 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 29 Apr 2018 11:10:29 +0200 Subject: [PATCH 3/3] clarify function header --- addons/common/fnc_waitUntilAndExecute.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/common/fnc_waitUntilAndExecute.sqf b/addons/common/fnc_waitUntilAndExecute.sqf index 7e7052c94..5dcf7f388 100644 --- a/addons/common/fnc_waitUntilAndExecute.sqf +++ b/addons/common/fnc_waitUntilAndExecute.sqf @@ -10,7 +10,8 @@ Parameters: _condition - The function to evaluate as condition. _statement - The function to run once the condition is true. _args - Parameters passed to the functions (statement and condition) executing. (optional) - _timeout - Timeout for the condition in seconds. (optional) + _timeout - If >= 0, timeout for the condition in seconds. If < 0, no timeout. + Exactly 0 means timeout immediately on the next iteration.(optional, default -1) _timeoutCode - Will execute instead of _statement if the condition times out. (optional) Passed Arguments: