-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common - Added CBA_fnc_execAfterNFrames from ZEN (#1584)
* Added n frame delay * Revert "Added n frame delay" This reverts commit 50df691. * Added function from ZEN * Update addons/common/fnc_execAfterNFrames.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update fnc_execNextFrame.sqf --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
- Loading branch information
1 parent
c472830
commit 263286f
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_execAfterNFrames | ||
Description: | ||
Executes the given code after the specified number of frames. | ||
Parameters: | ||
_function - The function to run. <CODE> | ||
_args - Parameters passed to the function executing. This will be the same array every execution. (optional, default: []) <ANY> | ||
_frames - The amount of frames the execution of the function should be delayed by. (optional, default: 0) <NUMBER> | ||
Returns: | ||
Nothing Useful | ||
Examples: | ||
(begin example) | ||
[{hint "Done!"}, [], 5] call cba_fnc_execAfterNFrames; | ||
(end) | ||
Author: | ||
mharis001, donated from ZEN | ||
---------------------------------------------------------------------------- */ | ||
|
||
if (canSuspend) exitWith { | ||
[CBA_fnc_execAfterNFrames, _this] call CBA_fnc_directCall; | ||
}; | ||
|
||
params [["_function", {}, [{}]], ["_args", []], ["_frames", 0, [0]]]; | ||
|
||
if (_frames > 0) exitWith { | ||
[CBA_fnc_execAfterNFrames, [_function, _args, _frames - 1]] call CBA_fnc_execNextFrame; | ||
}; | ||
|
||
_args call _function; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters