-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
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 | ||
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