Search the Community
Showing results for tags 'display event handler'.
Found 1 result
-
Checking Multi-key Return Value KeyDown DisplayEH
jshock posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well, this will be my first question in the forums in I don't know how long, and I'm having a bit of trouble trying to articulate the question into something understandable, so bear with me :D. I feel I am either overthinking this or it's not possible to accomplish what I want, or I'm just missing some necessary knowledge. So, I am working with a KeyDown displayEH, the "key press" that I check for is the actionKeys within a User Custom Action. I can get the code to execute perfectly when a single key is defined and pressed (i.e. 'Y'), but the issue that arises is when I do a combination of a key with control/shift/alt (i.e. "Left Ctrl + Y"). I know that within the EH you can check to see if control/shift/alt have been pressed, however, I cannot check to see if the user has defined control/shift/alt as an additional key that needs to be pressed in conjunction with another key (i.e. 'Y'). The command "actionKeys" returns an array of all the keys defined for that particular action (under configure>controls), for example, if the only key I have defined for custom User Action #9 is 'Y' the return of the command would be: [21] Which is easy enough to check within the EH by: (_this select 1) in actionKeys "User9" However, if I have the keybind set to "Left Ctrl + Y" it returns: [4.86539e+008] Which within the scope of this particular EH instance would return true that a control key is pressed, however, as far as I can tell, I can't check to make sure 'Y' is pressed along with it because the keybinding value of "Left Ctrl + Y" is some large number of (I assume) the two combined key values. So, question being, how would I calculate combined key values to be able to check against what is being returned by actionKeys, or what other means by which can I check to see if any particular key combination defined within a User Custom Action are pressed at the same time. And again stating that I feel I may simply be overthinking this as I've looked at this code quite late the last few nights, but still can't come to a final working set of code. Here is a semi-psuedo as to what I'm after (doing): fnc_checkKeyBinding = { /*????*/ }; (findDisplay 46) displayAddEventHandler [ "KeyDown", { _handled = false; if ([_this] call fnc_checkKeyBinding) then { [] call fnc; _handled = true; }; _handled; } ];