BIS fnc addScriptedEventHandler: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(syntax, parameters, and examples, see also) |
||
Line 24: | Line 24: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [missionNamespace,"",""] call [[BIS_fnc_addScriptedEventHandler]]; |= Syntax | ||
|p1= |= Parameter 1 | |p1=<b>NAMESPACE, OBJECT, GROUP LOCATION or BOOLEAN</b> - namespace in which handler is saved| | ||
p2= <b>STRING</b> - handler name| | |||
p3=<b>CODE or STRING </b>- code executed upon calling |= Parameter 1 | |||
| |= Return value | |||
object: Object | |||
[type, command]: Array | |||
type: String - Event Handler type | |||
command: Code or String - code that should be executed once the event occurs, by default executed in missionNamespace | |||
| Number - The index of the currently added event handler is returned. Indices start at 0 for each unit and increment with each added event handler.|= Return value | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Examples: | |||
|x1= <code></code> |= | |x1= <code> [missionNamespace,"event",{hint "Hello World";}] call bis_fnc_addScriptedEventhandler; </code> |= | ||
|x2= stacking code:<code>[missionNamespace,"event",{STRING "Hello World";}] call BIS_fnc_addScriptedEventhandler; | |||
[missionNamespace,"event",{hint STRING;}] call BIS_fnc_addScriptedEventhandler; | |||
[missionNamespace,"event",[]] call BIS_fnc_callScriptedEventHandler; | |||
</code> will show "Hello World" on screen. |= | |||
|x3= <code> [true,"event",{hint "Hello World";}] call bis_fnc_addScriptedEventhandler; </code> | |||
Boolean will default to misionNameSpace |= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[BIS_fnc_callScriptedEventHandler]] [[BIS_fnc_removeScriptedEventHandler]] [[BIS_fnc_removeAllScriptedEventHandlers]] |= See also | |||
| [[BIS_fnc_callScriptedEventHandler]] |= See also | |||
}} | }} | ||
Line 49: | Line 68: | ||
[[Category:Functions|{{uc:addScriptedEventHandler}}]] | [[Category:Functions|{{uc:addScriptedEventHandler}}]] | ||
[[Category:{{Name|arma3}}: Functions|{{uc:addScriptedEventHandler}}]] | [[Category:{{Name|arma3}}: Functions|{{uc:addScriptedEventHandler}}]] | ||
Revision as of 21:18, 18 May 2016
Description
- Description:
/* Description: Add scripted event handler Parameter(s): 0: NAMESPACE, OBJECT, GROUP or LOCATION - namespace in which handler is saved 1: STRING - handler name 2: CODE or STRING - code executed upon calling Returns: NUMBER - handler ID */
(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [missionNamespace,"",""] call BIS_fnc_addScriptedEventHandler;
- Parameters:
- NAMESPACE, OBJECT, GROUP LOCATION or BOOLEAN - namespace in which handler is saved
- STRING - handler name
- CODE or STRING - code executed upon calling
- Return Value:
- Number - The index of the currently added event handler is returned. Indices start at 0 for each unit and increment with each added event handler.
Examples
- Example 1:
[missionNamespace,"event",{hint "Hello World";}] call bis_fnc_addScriptedEventhandler;
- Example 2:
- stacking code:
[missionNamespace,"event",{STRING "Hello World";}] call BIS_fnc_addScriptedEventhandler; [missionNamespace,"event",{hint STRING;}] call BIS_fnc_addScriptedEventhandler; [missionNamespace,"event",[]] call BIS_fnc_callScriptedEventHandler;
will show "Hello World" on screen. - Example 3:
[true,"event",{hint "Hello World";}] call bis_fnc_addScriptedEventhandler;
Boolean will default to misionNameSpace
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