BIS fnc addScriptedEventHandler: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *T([a-z ])" to "$1 - t$2") |
||
(33 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=function | |||
|game1= arma3 | |||
|version1= 1.00 | |||
| | |gr1= Event Handlers | ||
| | |descr= 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]]. | ||
| | |s1= [namespace, name, code] call [[BIS_fnc_addScriptedEventHandler]] | ||
| | |p1= namespace: [[Namespace]], [[Object]], [[Group]], [[Location]], [[Boolean]], [[Control]] or [[Display]] - namespace in which the EH is stored | ||
|p2= name: [[String]] - event name | |||
|p2= name: [[String]] - | |||
| [[ | |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 | |||
|x1= < | |x1= <sqf>[missionNamespace, "event", { hint "Hello World" }] call BIS_fnc_addScriptedEventHandler;</sqf> | ||
|x2= < | |x2= <sqf>[true, "event", { hint "Hello World" }] call BIS_fnc_addScriptedEventHandler;</sqf> | ||
Boolean will default to [[missionNamespace]] | Boolean will default to [[missionNamespace]]. | ||
|seealso= [[BIS_fnc_callScriptedEventHandler]] [[BIS_fnc_removeScriptedEventHandler]] [[BIS_fnc_removeAllScriptedEventHandlers]] | |||
}} | }} | ||
Latest revision as of 16:50, 8 November 2023
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:
- Example 2:
- 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