addUserActionEventHandler: Difference between revisions
Lou Montana (talk | contribs) (Fix _thisEvent v2.20 information) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
| Line 20: | Line 20: | ||
* {{hl|"Analog"}} | * {{hl|"Analog"}} | ||
|p3= expression: [[Code]] - expression that will be executed in [[missionNamespace]] when event handler fires. | |p3= expression: [[Code]] - expression that will be executed in [[missionNamespace]] when event handler fires. | ||
* {{hl|{{Link|Magic Variables#thisEventHandler|_thisEventHandler}}}} returns the event handler index | |||
* {{hl|{{Link|Magic Variables#thisEvent|_thisEvent}}}} returns the event type (the ''event'' parameter, either {{hl|"Activate"}}, {{hl|"Deactivate"}} or {{hl|"Analog"}}) | |||
|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 | ||
Latest revision as of 14:05, 10 March 2026
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.
- _thisEventHandler returns the event handler index
- _thisEvent returns the event type (the event parameter, either "Activate", "Deactivate" or "Analog")
- 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
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note