{"name":"BIS_fnc_addScriptedEventHandler","operator":null,"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","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.00"}],"since":{"game":"arma3","name":"Arma 3","version":"1.00"},"arma3_since":"1.00","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"namespace","type":"Namespace, Object, Group, Location, Boolean, Control or Display","optional":false,"default":null,"description":"namespace in which the EH is stored","types":["Namespace","Object","Group","Location","Boolean","Control","Display"],"since":null,"text":"namespace: Namespace, Object, Group, Location, Boolean, Control or Display - namespace in which the EH is stored"},{"name":"name","type":"String","optional":false,"default":null,"description":"event name","types":["String"],"since":null,"text":"name: String - event name"},{"name":"code","type":"Code or String","optional":false,"default":null,"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.","types":["Code","String"],"since":null,"text":"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."}],"returns":{"type":"Number","types":["Number"],"description":"the ID of the new Event Handler","text":"Number - the ID of the new Event Handler"}}],"examples":[{"text":"```sqf\n[missionNamespace, \"event\", { hint \"Hello World\" }] call BIS_fnc_addScriptedEventHandler;\n```","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;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_callScriptedEventHandler","BIS_fnc_removeScriptedEventHandler","BIS_fnc_removeAllScriptedEventHandlers"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Event Handlers","Functions","Introduced with Arma 3 version 1.00"],"docblock":null,"filled_from_docblock":[]}