CBA_fnc_createPerFrameHandlerObject

Description

Creates a PFH object, that will execute code every frame, or every x number of seconds.

Parameters

_functionThe function you wish to execute.  <CODE>
_delayThe amount of time in seconds between executions, 0 for every frame.  (optional, default: 0) <NUMBER>
_argsParameters passed to the function executing.  (optional) <ANY>
_startFunction that is executed when the PFH is added.  (optional) <CODE>
_endFunction that is executed when the PFH is removed.  (optional) <CODE>
_runConditionCondition that has to return true for the PFH to be executed.  (optional, default {true}) <CODE>
_exitConditionCondition that has to return true to delete the PFH object.  (optional, default {false}) <CODE>
_privateList of local variables that are serialized between executions.  (optional) <CODE>

Passed Arguments

_thisThe PFH logic.  <LOCATION>

More variables are attached to this PFH logic than can be retrieved via ‘getVariable’.  (_this getVariable “params”) It is not advised to overwrite these variables with ‘setVariable’!

”params”Parameters passed by this function.  Same as _args from above.  <ANY>
”handle”A number representing the handle of the PFH.  <NUMBER>
”private”List of local variables that are serialized between executions.  Same as _private from above.  ARRAY
”start”Same as _start from above.  <CODE>
”end”Same as _end from above.  <CODE>
”run”Same as _function from above.  <CODE>
”run_condition”Same as _runCondition from above.  <CODE>
”exit_condition”Same as _exitCondition from above.  <CODE>
”serialize”Internal reserved variable.
”deserialize”Internal reserved variable.

The PFH logic can be used to store additional custom variables.

Returns

_logicThe PFH logic.  <LOCATION>

Examples

[
    { systemChat format ["frame! params: %1", _this getVariable "params"]; },
    0,
    ["some_params", [1,2,3]],
    { systemChat format ["start! params: %1", _this getVariable "params"]; _test = 127; },
    { systemChat format ["end! params: %1",   _this getVariable "params"]; systemChat str [_test] },
    { random 1 > 0.5 },
    { random 1 > 0.8 },
    "_test"
] call CBA_fnc_createPerFrameHandlerObject;

Author

Nou & Jaynus, donated from ACRE project code for use by the community; commy2

Array to read from [Array]
Close