inGameUISetEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " {2,}\}\}" to " }}") |
Lou Montana (talk | contribs) m (Text replacement - "{{Command " to "{{RV|type=command ") |
||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma1 | | arma1 |
Revision as of 10:04, 23 January 2021
Description
- Description:
- Description needed
- Groups:
- GUI Control - Event HandlersEvent HandlersInteraction
Syntax
- Syntax:
- Syntax needed
- Parameters:
- [handlerName, function]: Array
- handlerName: String
- function: String
- Return Value:
- Return value needed
Examples
- Example 1:
inGameUISetEventHandler ["Action","hint 'Lights, Camera, Action!'; true"];
- Example 2:
inGameUISetEventHandler ["PrevAction", "hint str _this; false"]; inGameUISetEventHandler ["NextAction", "hint str _this; false"]; inGameUISetEventHandler ["Action", "hint str _this; false"];
- Example 3:
- Deny any weapon disassembly:
inGameUISetEventHandler ["Action", " if (_this select 3 == 'DisAssemble') then { hint 'You are not allowed to do this'; true } "];
- Example 4:
- Detect explosive/mine placement:
onMagazineUse = ' params ["_target", "", "", "_action", "", "", "", "", "", "", "_event"]; if (_action == "UseMagazine") then { if (_event == "Action") then { 0 = _target spawn { waitUntil {!(all_magazines isEqualTo magazines _this)}; { 0 = all_magazines deleteAt (all_magazines find _x); } count magazines _this; hint format ["Magazine Used: %1", all_magazines select 0]; } } else { all_magazines = magazines _target; }; }; false '; inGameUISetEventHandler ["PrevAction", onMagazineUse]; inGameUISetEventHandler ["NextAction", onMagazineUse]; inGameUISetEventHandler ["Action", onMagazineUse];
Additional Information
- See also:
- See also needed
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
- Posted on May 12, 2016 - 20:51 (UTC)
- AgentRev
- In case of the "Action" event, (param 6 || param 9) also denotes if the action is performed or not. For example, if the action menu is closed or fading off, pressing Spacebar will bring it up and trigger an "Action" event; in that case, param 9 (action menu visibility) is false. But if the action menu is open, and Spacebar is pressed to perform the selected action, then param 9 will be true. If param 6 (showWindow) is true, then it means the action was performed, regardless of param 9.
- Posted on February 08, 2017 - 18:53 (UTC)
- Pierre MGI
-
This powerful command can override the actions (previous/next/action), depending on true/false return.
But, the command overrides itself, no matter of the returned value. That means, if two mods or scripts are using the same command parameter, say 'action', the last inGameUISetEventHandler 'action' will override the first one.
Example:
trigger1 :inGameUISetEventHandler ["Action","hint 'action for mod 1';true "];// true or false doesn't matter here
trigger2 (delayed):inGameUISetEventHandler ["Action","false "];// true or false doesn't matter here
trigger2 will run after trigger1, then, you'll never see the hint, what ever the trigger2 action code could be. What ever could be the last code, it will override all previous ones.
You have to group these codes in a same event handler.
But, beyond this, inGameUISetEventHandler is not stackable and implies a competition between scripts (or mods) using it.