{"name":"BIS_fnc_addScriptedEventHandler","title":"BIS fnc addScriptedEventHandler","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler","revid":349191,"updated":"2023-11-08T14:50:40Z","groups":["Event Handlers"],"status":"ok","games":{"arma3":"1.00"},"since":"arma3 1.00","arma3_since":"1.00","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.","syntaxes":[{"syntax":"[namespace, name, code] call BIS_fnc_addScriptedEventHandler","params":[{"name":"namespace","type":"Namespace, Object, Group, Location, Boolean, Control or Display","description":"namespace in which the EH is stored","type_expr":"Namespace | Object | Group | Location | Boolean | Control | Display"},{"name":"name","type":"String","description":"event name","type_expr":"String"},{"name":"code","type":"Code or String","description":"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.","type_expr":"Code | String"}],"returns":{"type":"Number","type_expr":"Number","description":"the ID of the new Event Handler"}}],"examples":[{"code":["[missionNamespace, \"event\", { hint \"Hello World\" }] call BIS_fnc_addScriptedEventHandler;"]},{"text":"```sqf\n[true, \"event\", { hint \"Hello World\" }] call BIS_fnc_addScriptedEventHandler;\n```\n\nBoolean will default to missionNamespace.","code":["[true, \"event\", { hint \"Hello World\" }] call BIS_fnc_addScriptedEventHandler;"]}],"see_also":["BIS_fnc_callScriptedEventHandler","BIS_fnc_removeScriptedEventHandler","BIS_fnc_removeAllScriptedEventHandlers"]}