BIS fnc addScriptedEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ :\\\-\/|()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
(Improvements here and there)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma3
|game1= arma3


|1.00
|version1= 1.00


|gr1= Event Handlers
|gr1= Event Handlers


| Adds scripted event handler and returns its id. Additionally "ScriptedEventHandlerAdded" scripted EH is called. For the list of available scripted event handlers see [[Arma 3: Event Handlers/ScriptedEventHandlers]].
|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]].


| [namespace, name, code] call [[BIS_fnc_addScriptedEventHandler]]
|s1= [namespace, name, code] call [[BIS_fnc_addScriptedEventHandler]]


|p1= namespace: [[Namespace]], [[Object]], [[Group]], [[Location]], [[Boolean]], [[Control]] or [[Display]] - namespace in which handler is saved
|p1= namespace: [[Namespace]], [[Object]], [[Group]], [[Location]], [[Boolean]], [[Control]] or [[Display]] - Namespace in which the EH is stored


|p2= name: [[String]] - handler name
|p2= name: [[String]] - Event name


|p3= code: [[Code]] or [[String]] - code executed upon calling
|p3= code: [[Code]] or [[String]] - The code that is executed when the EH fires


| [[Number]] - id of the currently added event handler
|r1= [[Number]] - The ID of the new Event Handler


|x1= <code>[<nowiki/>[[missionNamespace]], "event", { [[hint]] "Hello World" }] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code>
|x1= <code>[<nowiki/>[[missionNamespace]], "event", { [[hint]] "Hello World" }] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code>


|x2= <code>[<nowiki/>[[true]], "event", { [[hint]] "Hello World" }] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code>  
|x2= <code>[<nowiki/>[[true]], "event", { [[hint]] "Hello World" }] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code>  
Boolean will default to [[missionNamespace]]
Boolean will default to [[missionNamespace]].
|seealso= [[BIS_fnc_callScriptedEventHandler]], [[BIS_fnc_removeScriptedEventHandler]], [[BIS_fnc_removeAllScriptedEventHandlers]]
 
|seealso= [[BIS_fnc_callScriptedEventHandler]] [[BIS_fnc_removeScriptedEventHandler]] [[BIS_fnc_removeAllScriptedEventHandlers]]
}}
}}

Revision as of 11:26, 31 March 2021

Hover & click on the images for description

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
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