-
Notifications
You must be signed in to change notification settings - Fork 148
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
Port ACE delayed execution functions to CBA #288
Merged
Killswitch00
merged 1 commit into
CBATeam:master
from
nicolasbadano:aceDelayedExecutionFunctions
Mar 5, 2016
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,30 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_execNextFrame | ||
|
||
Description: | ||
Executes a code once in non sched environment on the next frame. | ||
|
||
Parameters: | ||
_function - The function to run. <CODE> | ||
_args - Parameters passed to the function executing. This will be the same array every execution. [optional] <ANY> | ||
|
||
Returns: | ||
Nothing | ||
|
||
Examples: | ||
(begin example) | ||
[{player sideChat format ["This is frame %1, not %2", diag_frameno, _this select 0];}, [diag_frameno]] call CBA_fnc_execNextFrame; | ||
(end) | ||
|
||
Author: | ||
esteldunedain and PabstMirror, donated from ACE3 | ||
---------------------------------------------------------------------------- */ | ||
#include "script_component.hpp" | ||
|
||
params [["_function", {}, [{}]], ["_args", []]]; | ||
|
||
if (diag_frameno != GVAR(nextFrameNo)) then { | ||
GVAR(nextFrameBufferA) pushBack [_args, _function]; | ||
} else { | ||
GVAR(nextFrameBufferB) pushBack [_args, _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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_waitAndExecute | ||
|
||
Description: | ||
Executes a code once in non sched environment with a given game time delay. | ||
|
||
Parameters: | ||
_function - The function you wish to execute. <CODE> | ||
_args - Parameters passed to the function executing. This will be the same array every execution. [optional] <ANY> | ||
_delay - The amount of time in seconds between executions, 0 for every frame. [optional] (default: 0) <NUMBER> | ||
|
||
Returns: | ||
Nothing | ||
|
||
Examples: | ||
(begin example) | ||
[{player sideChat format ["5s later! _this: %1", _this];}, ["some","params",1,2,3], 5] call CBA_fnc_waitAndExecute; | ||
(end) | ||
|
||
Author: | ||
esteldunedain and PabstMirror, donated from ACE3 | ||
---------------------------------------------------------------------------- */ | ||
#include "script_component.hpp" | ||
|
||
params [["_function", {}, [{}]], ["_args", []], ["_delay", 0, [0]]]; | ||
|
||
GVAR(waitAndExecArray) pushBack [CBA_missionTime + _delay, _function, _args]; | ||
GVAR(waitAndExecArrayIsSorted) = false; |
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,27 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_waitUntilAndExecute | ||
|
||
Description: | ||
Executes a code once in non sched environment after a condition is true. | ||
|
||
Parameters: | ||
_conditionFunction - The function to evaluate as condition. <CODE> | ||
_statementFunction - The function to run once the condition is true. <CODE> | ||
_args - Parameters passed to the function executing. This will be the same array every execution. [optional] <ANY> | ||
|
||
Returns: | ||
Nothing | ||
|
||
Examples: | ||
(begin example) | ||
[{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [player]] call CBA_fnc_waitUntilAndExecute; | ||
(end) | ||
|
||
Author: | ||
joko // Jonas, donated from ACE3 | ||
---------------------------------------------------------------------------- */ | ||
#include "script_component.hpp" | ||
|
||
params [["_conditionFunction", {}, [{}]], ["_statementFunction", {}, [{}]], ["_args", []]]; | ||
|
||
GVAR(waitUntilAndExecArray) pushBack [_conditionFunction, _statementFunction, _args]; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening brace on same line as class. I know it's not used in others in this file but it has to get converted anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ït's not used at all in cba_common, so I prefer to maintain consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@commy2 is changing it, he is currently going through entire cba_common. But sure.