Author Topic: Press and Hold Options  (Read 1904 times)

nka

  • Newbie
  • *
  • Posts: 5
Press and Hold Options
« on: February 27, 2024, 07:10:57 AM »
I did reply here, but I will create my own topic.


I want to create a Key Press that is hold the button like I would do on a Keyboard as long as I hold it on the Joystick.

I found two way of doing it, but I feel like it could me made in a better way.

1) Creating two "Commands". One  to "Key Press Down", and the other one to "Key Press Release".



This work, but I have to create two separated commands.

2) Create a "Loop" to release the key on the command.


This work, but I have to set key and button twice introducing risk of error. For example, I could "Press W" and "Release  Q" by error or map button 21 instant of 22 and have to go back fix it... it's not that bad, just "time consuming".

I was wondering if there was an option like "Hold key while button is held down and release" or using variable so I can do :
Code: [Select]
Press Down W key
Start Loop While %button pressed%
End Loop
Release %previous key in this command% key

else, the last option I might use is to create all the "Commands" in the GUI with "Press Down _ Key", then using a script to edit the CSV (or XML) file to add the "Start Loop While/Release" of each commands.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Press and Hold Options
« Reply #1 on: February 27, 2024, 11:36:06 AM »
...something like this should work for what you describe:

Code: [Select]
Press down Left Shift key
Start Loop While :  Joystick 1 Button 42 Is Pressed
End Loop
Release Left Shift key




nka

  • Newbie
  • *
  • Posts: 5
Re: Press and Hold Options
« Reply #2 on: February 27, 2024, 11:47:07 AM »
yes, this is what I do right now (option 2), but I was wondering if there was a built-in option to do this. I'll take that as a no 😁

Thanks a lot!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Press and Hold Options
« Reply #3 on: February 27, 2024, 12:50:39 PM »
I see what you're saying about making it easier with something like '%button pressed%' - it's a great idea, however, there can be multiple buttons/keyboard keys (modifiers, left and right) pressed at a time to trigger a command.  Gets kind of icky.

I've had it one the whiteboard for some time to add device mapping capability to VA.  I have not incorporated this, as there are already apps that exist that do this (like Joy2Key).  One day, perhaps?

nka

  • Newbie
  • *
  • Posts: 5
Re: Press and Hold Options
« Reply #4 on: February 27, 2024, 01:45:40 PM »
Thanks a lot Gary, VoiceAttack is what I prefer using, so I made it with the manual mapping and it's working fine! :)