addUserActionEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "(\|[pr][0-9]+ *= *[^-]+) *- *E([a-z])" to "$1 - e$2")
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *T([a-z ])" to "$1 - t$2")
Line 23: Line 23:
{{Feature | important | ''expression'' can only be [[Code]], '''not''' [[String]].}}
{{Feature | important | ''expression'' can only be [[Code]], '''not''' [[String]].}}


|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= <sqf>private _ehId = addUserActionEventHandler ["ReloadMagazine", "Activate", { systemChat "reloading!"; }];</sqf>
|x1= <sqf>private _ehId = addUserActionEventHandler ["ReloadMagazine", "Activate", { systemChat "reloading!"; }];</sqf>

Revision as of 15:51, 8 November 2023

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.
The Event Handler index is available as _thisEventHandler during Event Handler code execution.
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