inputMouse: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|seealso= *\[\[([^ ]+)\]\], \[\[([^ ]+)\]\]" to "|seealso= $1 $2")
m (Some wiki formatting)
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
|game1= arma3
|game1= arma3
|version1= 2.08
|version1= 2.08
|branch=dev


|gr1= Interaction
|gr1= Interaction
Line 35: Line 34:
|s1= [[inputMouse]] button
|s1= [[inputMouse]] button


|p1= button: [[Number]] - button number 0...7. 0-LMB, 1-RMB, 2-MMB
|p1= button: [[Number]] - button number 0..7: 0-LMB, 1-RMB, 2-MMB


|r1= [[Number]] - the state of the button:
|r1= [[Number]] - the state of the button:
Line 51: Line 50:




|x1= State of the RMB:<code>[[onEachFrame]] { [[hintSilent]] [[str]] [[inputMouse]] 1 };</code>
|x1= State of the RMB:
|x2= Detect LCtrl + 2xRMB:<code>[[onEachFrame]] { [[hintSilent]] [[str]] [[inputMouse]] "487653633" };</code>
<sqf>onEachFrame { hintSilent str inputMouse 1 };</sqf>


|seealso= [[inputController]] [[inputAction]] [[actionKeys]] [[actionKeysImages]] [[actionKeysNames]] [[actionIDs]] [[actionParams]] [[addAction]] [[setUserActionText]], [[inGameUISetEventHandler]], [[showHUD]], [[removeAction]], [[removeAllActions]], [[action]]
|x2= Detect LCtrl + 2xRMB:
<sqf>onEachFrame { hintSilent str inputMouse "487653633" };</sqf>
 
|seealso= [[inputController]] [[inputAction]] [[actionKeys]] [[actionKeysImages]] [[actionKeysNames]] [[actionIDs]] [[actionParams]] [[addAction]] [[setUserActionText]] [[inGameUISetEventHandler]] [[showHUD]] [[removeAction]] [[removeAllActions]] [[action]]
}}
}}

Latest revision as of 12:40, 3 May 2022

Hover & click on the images for description

Description

Description:
Returns the state of mouse button action, alone or in combination with key presses. For more information on codes and combos see Arma_3:_Modded_Keybinding and DIK_KeyCodes but here are some examples of how codes could be hand constructed:
  • KEYBOARD_COMBO 16777216 (0x1000000)
  • DEVICE_MOUSE 65536 (0x10000)
  • HOLD_OFFSET 0
  • CLICK_OFFSET 128 (0x80)
  • DOUBLE_CLICK_OFFSET 256 (0x100)
  • SPECIAL_COMBINATIONS 1114112 (0x110000)
Click + Hold: BUTTON + DEVICE_MOUSE + HOLD_OFFSET = BUTTON + 65536 + 0
Click: BUTTON + DEVICE_MOUSE + CLICK_OFFSET = BUTTON + 65536 + 128 
Double Click: BUTTON + DEVICE_MOUSE + DOUBLE_CLICK_OFFSET = BUTTON + 65536 + 256

RMB Click + Hold:  1 + 65536 + 0 = 65537
RMB Click: 1 + 65536 + 128 = 65665
RMB Double Click: 1 + 65536 + 256 = 65793

Combo + Click + Hold: DIK * KEYBOARD_COMBO + SPECIAL_COMBINATIONS + BUTTON + HOLD_OFFSET = DIK * 16777216 + 1114112 + BUTTON + 0
Combo + Click: DIK * KEYBOARD_COMBO + SPECIAL_COMBINATIONS + BUTTON + CLICK_OFFSET = DIK * 16777216 + 1114112 + BUTTON + 128
Combo + Double Click: DIK * KEYBOARD_COMBO + SPECIAL_COMBINATIONS + BUTTON + DOUBLE_CLICK_OFFSET = DIK * 16777216 + 1114112 + BUTTON + 256

LShift + RMB Click + Hold: 42 * 16777216 + 1114112 + 1 + 0 = 705757185
LShift + RMB Click: 42 * 16777216 + 1114112 + 1 + 128 = 705757313
LShift + RMB Double Click: 42 * 16777216 + 1114112 + 1 + 256 = 705757441
Groups:
Interaction

Syntax

Syntax:
inputMouse button
Parameters:
button: Number - button number 0..7: 0-LMB, 1-RMB, 2-MMB
Return Value:
Number - the state of the button:
  • 0 - released
  • 1 - click
  • 2 - click + hold
  • 3 - double click
  • 4 - double click + hold

Alternative Syntax

Syntax:
inputMouse combocode
Parameters:
combocode: String - code or combination (see actionKeys)
Return Value:
Boolean - true if given code/combination detected, false otherwise

Examples

Example 1:
State of the RMB:
onEachFrame { hintSilent str inputMouse 1 };
Example 2:
Detect LCtrl + 2xRMB:
onEachFrame { hintSilent str inputMouse "487653633" };

Additional Information

See also:
inputController inputAction actionKeys actionKeysImages actionKeysNames actionIDs actionParams addAction setUserActionText inGameUISetEventHandler showHUD removeAction removeAllActions action

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