Author Topic: Modifier keys interfering with PRESSED and held keys  (Read 981 times)

JGFarris

  • Newbie
  • *
  • Posts: 49
    • My Facebook Page
Modifier keys interfering with PRESSED and held keys
« on: January 23, 2022, 03:29:21 PM »
So anyone who plays Elite Dangerous knows there are a LOT of key binds. There's no way to get away from using modifiers. However, my profile has some commands that requires keys to be held down for long periods of time and released when ready.

Example: I have a command to Roll Left. When I initiate this command, the key is pressed and held until I tell it to stop. Let's say it's the Q key. Because there are limited keys, I would like to use the Q for something else by using it with a modifier (SHIFT, CONTROL, ALT, etc.) but when I execute a "SHIFT-Q" (press and release), it releases my Q key (being held) before I am ready.

To be overly clear, I would like to have one command holds the Q down. Then another command press SHIFT-Q for 0.5 seconds, but then not release the Q from the first command. Is that possible?

There's just not enough keys on this keyboard. :-)
Jerry Farris, Jr.
Entrepreneur, Programmer and Disability Advocate
jerry@jerryfarris.com

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Modifier keys interfering with PRESSED and held keys
« Reply #1 on: January 23, 2022, 04:18:24 PM »
If your target application responds to the press, and doesn't require the release, you could set it up so that the Shift-Q command doesn't release the key if it was already pressed

E.G.
Code: [Select]
Begin Device State Check :  Keyboard Key 'Q' Is Pressed
    Set Boolean [~keyWasAlreadyPressed] to True
End Condition
Press down Left Shift+Q keys
Pause 0.5 seconds
Begin Boolean Compare : [~keyWasAlreadyPressed] Does Not Equal True
    Release Q key
End Condition
Release Left Shift key


If you're short on keys to use, it's worth checking whether F13 to F24 are recognized by the target application. They're not present on normal keyboards, so some input systems aren't set up for them, but if they're recognized that's an additional 12 keys that won't already be in use.

(keys that aren't physically present, and some that are, can be selected using the key chooser dialog, accessible from the keyboard icon on the keypress action's "Add a Keypress"/"Edit a Keypress" window)

JGFarris

  • Newbie
  • *
  • Posts: 49
    • My Facebook Page
Re: Modifier keys interfering with PRESSED and held keys
« Reply #2 on: January 23, 2022, 08:20:11 PM »
Now that device state check is a great idea. Can't believe I didn't think about that start with. I'll definitely check on the extra keys that might be there.

Thanks Pfeil!
Jerry Farris, Jr.
Entrepreneur, Programmer and Disability Advocate
jerry@jerryfarris.com