BIS fnc addStackedEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Stack all codes into one PFH will be less demanding than separated calling within multiple PFH. (note added))
Line 16: Line 16:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [key, event, code] call [[BIS_fnc_addStackedEventHandler]]; |= Syntax
| [key, event, code, arguments] call [[BIS_fnc_addStackedEventHandler]]; |= Syntax


|p1= key: [[String]] - unique identifier|= Parameter 1
|p1= key: [[String]] - unique identifier|= Parameter 1
Line 54: Line 54:
[[onMapSingleClick]] EH expects a [[Boolean]]. If you are planning to return [[true]] and override default behaviour, make sure it is added last.
[[onMapSingleClick]] EH expects a [[Boolean]]. If you are planning to return [[true]] and override default behaviour, make sure it is added last.


 
<dd class="notedate">Posted on 25 Jun, 2014
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]<dd class="note">
(ArmA3 1.22) Stack all codes into one PFH will be less demanding than separated calling within multiple PFH. E.g.
<code>
{
[([[format]] [“%1”,_forEachIndex]),”[[onEachFrame]]”,_code,[_x]] [[call]] [[BIS_fnc_addStackedEventHandler]];
} [[forEach]] [var0…var100]; //pretty demanding
</code>
<code>
[_id, ”[[onEachFrame]]”,{
  {_x [[call]] _code} [[forEach]] [var0…var100];
}] [[call]] [[BIS_fnc_addStackedEventHandler]]; //faster
</code>
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 12:08, 25 June 2014

Hover & click on the images for description

Description

Description:
Stack an event handler. Possible event handlers are:
  • "onEachFrame"
  • "onPlayerConnected"
  • "onPlayerDisconnected"
  • "onMapSingleClick"
  • "onPreloadStarted"
  • "onPreloadFinished"
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[key, event, code, arguments] call BIS_fnc_addStackedEventHandler;
Parameters:
key: String - unique identifier
event: String - event handler type, see Description
code: String or Code
arguments: Anything - arguments to make available in code
Return Value:
String

Examples

Example 1:
["someId", "onEachFrame", { hintSilent str time; }] call BIS_fnc_addStackedEventHandler;
Example 2:
["someId", "onEachFrame", { hintSilent str _this; }, "Hello world!"] call BIS_fnc_addStackedEventHandler;

Additional Information

See also:
BIS_fnc_removeStackedEventHandler

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Posted on November 1, 2013
neokika
More info at: http://forums.bistudio.com/showthread.php?167822-Stacked-event-handlers-OnEachFrame-OnPlayerConnected-etc
Posted on February 11, 2014
Killzone_Kid
onMapSingleClick EH expects a Boolean. If you are planning to return true and override default behaviour, make sure it is added last.
Posted on 25 Jun, 2014
ffur2007slx2_5
(ArmA3 1.22) Stack all codes into one PFH will be less demanding than separated calling within multiple PFH. E.g. { [(format [“%1”,_forEachIndex]),”onEachFrame”,_code,[_x]] call BIS_fnc_addStackedEventHandler; } forEach [var0…var100]; //pretty demanding [_id, ”onEachFrame”,{ {_x call _code} forEach [var0…var100]; }] call BIS_fnc_addStackedEventHandler; //faster

Bottom Section