addUserActionEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix)
No edit summary
Line 26: Line 26:
|r1= [[Number]] - The index of the currently added UserAction event handler is returned
|r1= [[Number]] - The index of the currently added UserAction event handler is returned


|x1= <code>[[private]] _ehId = [[addUserActionEventHandler]] ["Reload", "Activated", { [[systemChat]] "reloading!"; }];</code>
|x1= <code>[[private]] _ehId = [[addUserActionEventHandler]] ["Reload", "Activate", { [[systemChat]] "reloading!"; }];</code>


|seealso= [[removeUserActionEventHandler]] [[removeAllUserActionEventHandlers]] [[Arma 3: Event Handlers#UserAction Event Handlers|UserAction Event Handlers]]
|seealso= [[removeUserActionEventHandler]] [[removeAllUserActionEventHandlers]] [[Arma 3: Event Handlers#UserAction Event Handlers|UserAction Event Handlers]]
}}
}}

Revision as of 20:50, 18 June 2021

Hover & click on the images for description
Only available in Development branch(es) until its release with Arma 3 patch v2.06.

Description

Description:
Adds event handler attached to the current mission and returns event handler handle. For a list of available UserAction event handlers, see: Arma 3: Mission Event Handlers.
Groups:
Event Handlers

Syntax

Syntax:
addUserActionEventHandler [keyName, event, expression]
Parameters:
keyName: String - action key name - see inputAction/actions
event: String - event name - see UserAction Event Handlers. Can be one of:
  • "Activate"
  • "Deactivate"
  • "Analog"
expression: Code - Expression that will be executed in missionNamespace when event handler fires.
expression can only be Code, not String.
Return Value:
Number - The index of the currently added UserAction event handler is returned

Examples

Example 1:
private _ehId = addUserActionEventHandler ["Reload", "Activate", { systemChat "reloading!"; }];

Additional Information

See also:
removeUserActionEventHandler removeAllUserActionEventHandlers UserAction Event Handlers

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