BIS fnc addStackedEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <nowiki>[</nowiki>" to " [<nowiki/>")
(Added A3 suggestion to use MapSingleClick EH instead of the function)
Line 16: Line 16:
* <tt>"[[onMapSingleClick]]"</tt> - EH params are passed as array in <tt>_this</tt> (<tt>[<units>,<pos>,<alt>,<shift>]</tt>) and in special variables <tt>_units</tt>, <tt>_pos</tt>, <tt>_alt</tt>, <tt>_shift</tt>
* <tt>"[[onMapSingleClick]]"</tt> - EH params are passed as array in <tt>_this</tt> (<tt>[<units>,<pos>,<alt>,<shift>]</tt>) and in special variables <tt>_units</tt>, <tt>_pos</tt>, <tt>_alt</tt>, <tt>_shift</tt>
* <tt>"[[onPreloadStarted]]"</tt> - no EH params
* <tt>"[[onPreloadStarted]]"</tt> - no EH params
* <tt>"[[onPreloadFinished]]"</tt> - no EH params|DESCRIPTION=
* <tt>"[[onPreloadFinished]]"</tt> - no EH params
{{Feature arma3 | Since '''{{arma3}}''' v1.57 a stackable MissionEventHandler is available and should be used instead: [[Arma_3:_Event_Handlers/addMissionEventHandler#MapSingleClick|MapSingleClick]].
|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 02:40, 6 April 2020

{{Function|Comments= ____________________________________________________________________________________________

| arma3 |Game name=

|1.00|Game version= ____________________________________________________________________________________________

| Stacks an event handler. All event handlers accept user arguments, which are passed to the EH code in _this variable. If the EH has own params returned in _this variable as well, user arguments are appended to the end of _this array. Note that if you try to add empty EH, i.e. with empty code, it will simply be ignored.

Supported event handlers

  • "onEachFrame" - no EH params
  • "onPlayerConnected" - EH params are passed as array in _this ([<id>,<uid>,<name>,<jip>,<owner>]) and in special variables _id, _uid, _name, _jip, _owner
  • "onPlayerDisconnected" - EH params are passed as array in _this ([<id>,<uid>,<name>,<jip>,<owner>]) and in special variables _id, _uid, _name, _jip, _owner
  • "onMapSingleClick" - EH params are passed as array in _this ([<units>,<pos>,<alt>,<shift>]) and in special variables _units, _pos, _alt, _shift
  • "onPreloadStarted" - no EH params
  • "onPreloadFinished" - no EH params
Arma 3
Since Arma 3 v1.57 a stackable MissionEventHandler is available and should be used instead: MapSingleClick.

Notes

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

Posted on January 3, 2019 - 13:52 (UTC)
DrSova
For returning array with all ids: missionNamespace getVariable [format["BIS_stackedEventHandlers_%1",_event],[]]; Where is _event - name of event ('OnEachFrame', etc.)