addUserActionEventHandler

From Bohemia Interactive Community
Revision as of 18:11, 17 November 2021 by Lou Montana (talk | contribs) (Fix example)
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Adds a user action event handler to the current mission and returns its event handler index.
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 ["ReloadMagazine", "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