BIS fnc addScriptedEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|game([0-9])=([^ ]+) * \|version([0-9])=([^ ]+) * " to "|game$1=$2 |version$3=$4 ") |
No edit summary |
||
Line 14: | Line 14: | ||
|p2= name: [[String]] - Event name | |p2= name: [[String]] - Event name | ||
|p3= code: [[Code]] or [[String]] - The code that is executed when the EH fires | |p3= code: [[Code]] or [[String]] - The code that is executed when the EH fires. The magic variable [[Magic_Variables#thisScriptedEventHandler|_thisScriptedEventHandler]] can be used to access the event handler ID within the code. | ||
|r1= [[Number]] - The ID of the new Event Handler | |r1= [[Number]] - The ID of the new Event Handler |
Revision as of 11:18, 17 February 2022
Description
- Description:
- Adds a Scripted Event Handler and returns its ID. Additionally, the "ScriptedEventHandlerAdded" Scripted EH is called. For the full list of all available Scripted EHs see Arma 3: Scripted Event Handlers.
- Execution:
- call
- Groups:
- Event Handlers
Syntax
- Syntax:
- [namespace, name, code] call BIS_fnc_addScriptedEventHandler
- Parameters:
- namespace: Namespace, Object, Group, Location, Boolean, Control or Display - Namespace in which the EH is stored
- name: String - Event name
- code: Code or String - The code that is executed when the EH fires. The magic variable _thisScriptedEventHandler can be used to access the event handler ID within the code.
- Return Value:
- Number - The ID of the new Event Handler
Examples
- Example 1:
[missionNamespace, "event", { hint "Hello World" }] call BIS_fnc_addScriptedEventHandler;
- Example 2:
[true, "event", { hint "Hello World" }] call BIS_fnc_addScriptedEventHandler;
Boolean will default to missionNamespace.
Additional Information
- See also:
- BIS_fnc_callScriptedEventHandler BIS_fnc_removeScriptedEventHandler BIS_fnc_removeAllScriptedEventHandlers
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