inGameUISetEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(fixed)
(extended, example)
Line 11: Line 11:
* "Action" - action key press
* "Action" - action key press
* "NextAction" - mouse scroll down
* "NextAction" - mouse scroll down
This is "set" type EH, which means it will replace previously set EH of the same type. So to remove EH, set another one with empty string "" for the function.|= Description
This is "set" type EH, which means it will replace previously set EH of the same type. So to remove EH, set another one with empty string "" for the function.
<br><br>
Since Arma 3 v1.49.??? this EH returns array of params for selected/activated action in ''_this'' variable:
* 0: [[Object]] - target object to which action is attached
* 1: [[Object]] - caller object, basically [[player]]
* 2: [[Number]] - index of the action in action menu (0 - top most)
* 3: [[String]] - engine based action name ("User" for user added actions)
* 4: [[String]] - [[localize]]d action plane text as seen by the caller
* 5: [[Number]] - action ''priority'' value
* 6: [[Boolean]] - action ''showWindow'' value
* 7: [[Boolean]] - action ''hideOnUse'' value
* 8: [[String]] - action ''shortcut'' name or ""
* 9: [[Boolean]] - action menu visibility (on first scroll or action press the menu is still invisible, so no action is performed, only menu is shown)
* 10 [[String]] - EH event name|= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 24: Line 37:


|x1= <code>[[inGameUISetEventHandler]] ["Action","hint 'Lights, Camera, Action!'; true"];</code>|= EXAMPLE1
|x1= <code>[[inGameUISetEventHandler]] ["Action","hint 'Lights, Camera, Action!'; true"];</code>|= EXAMPLE1
|x2= <code>[[inGameUISetEventHandler]] ["PrevAction", "[[hint]] [[str]] _this; [[false]]"];
[[inGameUISetEventHandler]] ["NextAction", "[[hint]] [[str]] _this; [[false]]"];
[[inGameUISetEventHandler]] ["Action", "[[hint]] [[str]] _this; [[false]]"];</code>|= EXAMPLE2
|x3= Deny any weapon disassembly: <code>[[inGameUISetEventHandler]] ["Action", "
[[if]] (_this [[select]] 3 == 'DisAssemble') [[then]] {
[[hint]] 'You are not allowed to do this';
[[true]]
}
"];</code>|= EXAMPLE3
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 17:08, 4 August 2015

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Sets given event handler of in-game UI. If EH function returns true, performed action is overridden. Event handlers available are:
  • "PrevAction" - mouse scroll up
  • "Action" - action key press
  • "NextAction" - mouse scroll down
This is "set" type EH, which means it will replace previously set EH of the same type. So to remove EH, set another one with empty string "" for the function.

Since Arma 3 v1.49.??? this EH returns array of params for selected/activated action in _this variable:
  • 0: Object - target object to which action is attached
  • 1: Object - caller object, basically player
  • 2: Number - index of the action in action menu (0 - top most)
  • 3: String - engine based action name ("User" for user added actions)
  • 4: String - localized action plane text as seen by the caller
  • 5: Number - action priority value
  • 6: Boolean - action showWindow value
  • 7: Boolean - action hideOnUse value
  • 8: String - action shortcut name or ""
  • 9: Boolean - action menu visibility (on first scroll or action press the menu is still invisible, so no action is performed, only menu is shown)
  • 10 String - EH event name
Groups:
Uncategorised

Syntax

Syntax:
inGameUISetEventHandler [handlerName, function]
Parameters:
[handlerName, function]: Array
handlerName: String
function: String
Return Value:
Nothing

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 } "];

Additional Information

See also:
addEventHandlerctrlAddEventHandlerdisplayAddEventHandler

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

Notes

Bottom Section