addUserActionEventHandler: Difference between revisions
BrettMayson (talk | contribs) mNo edit summary |
Lou Montana (talk | contribs) (Fix _thisEvent v2.20 information) |
||
| Line 25: | Line 25: | ||
{{Feature|important | {{Feature|important | ||
|The magic variable {{hl|{{Link|Magic Variables#thisEvent|_thisEvent}}}} is available in these event handlers but can only return one of these three values: | |The magic variable {{hl|{{Link|Magic Variables#thisEvent|_thisEvent}}}} is available in these event handlers but can only return one of these three values: | ||
* {{hl|" | * {{hl|"Activate"}} | ||
* {{hl|" | * {{hl|"Deactivate"}} | ||
* {{hl|" | * {{hl|"Analog"}} | ||
}} | }} | ||
</spoiler> | </spoiler> | ||
Revision as of 12:55, 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.
The Event Handler index is available as _thisEventHandler during Event Handler code execution.
- 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