Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fnc_waitUntilAndExecute now can timeout for 0s #911

Merged
merged 3 commits into from
Apr 29, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions addons/common/fnc_waitUntilAndExecute.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commy2 suggests, describe what timeout 0 and -1 will mean.


Parameters:
_condition - The function to evaluate as condition. <CODE>
Expand Down Expand Up @@ -37,11 +38,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 [{
Expand Down