addUserActionEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Page creation) |
Lou Montana (talk | contribs) m (Text replacement - "\] +\[" to "] [") |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|game1= arma3 | |game1= arma3 | ||
|version1= 2.06 | |version1= 2.06 | ||
|eff= local | |eff= local | ||
Line 10: | Line 8: | ||
|gr1= Event Handlers | |gr1= Event Handlers | ||
|descr= Adds event handler | |descr= Adds a user action event handler to the current mission and returns its event handler index. | ||
|s1= [[addUserActionEventHandler]] | |s1= [[addUserActionEventHandler]] [keyName, event, expression] | ||
|p1= | |p1= keyName: [[String]] - action key name - see [[inputAction/actions]] | ||
|p2= event: [[String]] - event name - see [[Arma 3: Event Handlers#UserAction Event Handlers|UserAction Event Handlers]]. Can be one of: | |p2= event: [[String]] - event name - see [[Arma 3: Event Handlers#UserAction Event Handlers|UserAction Event Handlers]]. Can be one of: | ||
Line 21: | Line 19: | ||
* "Analog" | * "Analog" | ||
|p3= expression: [[Code]] - | |p3= expression: [[Code]] - expression that will be executed in [[missionNamespace]] when event handler fires.<br> | ||
The Event Handler index is available as {{hl|_thisEventHandler}} during Event Handler code execution. | |||
{{Feature | important | ''expression'' can only be [[Code]], '''not''' [[String]].}} | {{Feature | important | ''expression'' can only be [[Code]], '''not''' [[String]].}} | ||
|r1= [[Number]] - | |r1= [[Number]] - the index of the currently added UserAction event handler is returned | ||
|x1= < | |x1= <sqf>private _ehId = addUserActionEventHandler ["ReloadMagazine", "Activate", { systemChat "reloading!"; }];</sqf> | ||
|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]] | ||
}} | }} |
Latest revision as of 11:46, 5 May 2024
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 or on the Forums.
Only post proven facts here! Add Note