Author Topic: Multiple controls on one or two joystick buttons  (Read 1886 times)

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Multiple controls on one or two joystick buttons
« on: April 29, 2021, 01:59:17 AM »
Hello everybody,
I'm trying to set up OSU/Sayobot keyboards in joystick mode to assign different VoiceAttack commands to their buttons.
It works pretty well in general, but it gets complicated when I want to assign several commands to the same button. I use "long click", "hold click", "double click" or combinations of two clicks/buttons.
The problem is that even if I try the "do not use if other keys are pressed" or "execute only when keys are released" settings, the functions assigned to the single click/button still execute before or after the key action... and this in a non-constant or random way.
Does anyone have a solution for me?
I tried in the joystick settings, playing with the bounces, but I couldn't find what to do to solve my problem.
Thank you in advance for your help.
Best regards.
Edgar

PS: attached are various screenshots of a button setup test.
"Joystick 2 Button 12 + Joystick 2 Button 10" should return only the "copy" command, but I have the "control" command that interferes with the key sequence. The "Control" command is assigned to "Joystick 2 Button 10" in one-touch mode.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple controls on one or two joystick buttons
« Reply #1 on: April 29, 2021, 02:19:18 AM »
What should happen is that the Ctrl command executes if you press and release button 10, whereas the paste command would execute as soon as you press and release buttons 10 and 12, which would also execute the Ctrl command as soon as button 10 is released as part of that combination, as both commands operate independently of each other.

You could combine these commands in to a single command that triggers off of the button that is shared by both commands (button 10, in this example), and then while that button is pressed check whether button 12 is also pressed, so that if it is one set of actions executes, but if instead button 10 is released without button 12 also being pressed, another set of actions executes.

E.G.
Code: [Select]
Start Loop While :  Joystick 2 Button 10 Is Pressed
    Begin Device State Check :  Joystick 2 Button 12 Is Pressed
        Press Left Ctrl+V keys and hold for 0,06 seconds and release
        Say, 'Coller'
    End Condition - Exit when condition met
End Loop
Begin Text Compare : [{ACTIVEWINDOWPROCESSNAME}] Contains 'Vectorworks'
    Exit Command
Else
    Press Left Ctrl key and hold for 0,06 seconds and release
    Say, 'ctrl'
End Condition

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #2 on: April 29, 2021, 02:36:25 AM »
Hello Pfeil,
Always so fast! :D
I discovered the if & else conditions during our last exchange, I will try now with the loop.
I should be able to do it with a little trial and error.
Thanks for your answer.
Best regards.
Edgar

 

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #3 on: April 30, 2021, 03:14:00 AM »
Hi Pfeil,

I have tried your method, but unfortunately it does not give the desired result.

Here is the attached screenshot of my settings.
In fact, everything in the loop does not run.

Only the "Ctrl" part runs.

I can't find where the error comes from?
If you have an idea ... I'm interested.

Thanks in advance.

Best regards.
Edgar

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple controls on one or two joystick buttons
« Reply #4 on: April 30, 2021, 03:22:10 AM »
Just to make sure: In your original example, the second button was Joystick 2, Button 12, but in your latest example you're using Joystick 2, Button 11 instead. Is that correct?

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #5 on: April 30, 2021, 03:27:56 AM »
Yes, that's right

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple controls on one or two joystick buttons
« Reply #6 on: April 30, 2021, 03:32:52 AM »
If the command is working correctly, what should be happening is that it executes when you press Joystick 2 Button 10, and while you hold that button down, nothing should happen.

If you then also press Joystick 2 Button 11, you should hear "Copier joystick 2". If instead you don't press the additional button, and release Joystick 2 Button 10, you should hear "ctrl"

Is this not what is happening?

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #7 on: April 30, 2021, 03:48:05 AM »
No unfortunately, this is not what happens...
The other joystick 2 keys are also assigned to other commands.
Also with long hold time options.
Maybe that's where the problem comes from?

Or maybe my joystick emulator keyboard?

I had tried a command like in the attached screenshot.
The joystick keys do not influence the execution of this one, while the space key does...

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple controls on one or two joystick buttons
« Reply #8 on: April 30, 2021, 03:55:59 AM »
Do the joystick buttons get held down, or do they only get pressed momentarily and then released?

You should be able to check that in the Game Controllers applet (press Win+R, input "joy.cpl", and click "OK") by selecting your device and choosing "Properties". If the red icon for the button only blinks momentarily, that'd explain the behavior.

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #9 on: April 30, 2021, 04:02:27 AM »
Ha-ha!

It is the assignment of the long click on the key 10 of the joystick 2 which causes the problem.
If I disable joystick 2 for the other command I hear "copy joystick 2" .

And on joy.cpl, the button stays on permanently when it is pressed.


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Multiple controls on one or two joystick buttons
« Reply #10 on: April 30, 2021, 04:17:19 AM »
If you have another command with the "Shortcut is invoked when long-pressed" for the same button that triggers this command, this command shouldn't trigger at all if the button is held down (it would trigger if the button is held down less than the long press timeout, but in that case the release happens before this command triggers, meaning the loop never runs as the button is no longer down). They can't be combined like that.

To have all three functions, the command can be modified, however:
Code: [Select]
Set date [~longPressTimeout] to [~longPressTimeout] plus [700] milliseconds
Start Loop While :  Joystick 2 Button 10 Is Pressed
    Begin Device State Check :  Joystick 2 Button 12 Is Pressed
        Press Left Ctrl+V keys and hold for 0,06 seconds and release
        Say, 'Coller'
    Else If Date Compare : [~longPressTimeout] Is Before Current Date/Time
        Say, 'long press detected'
    End Condition - Exit when condition met
End Loop
Begin Text Compare : [{ACTIVEWINDOWPROCESSNAME}] Contains 'Vectorworks'
    Exit Command
Else
    Press Left Ctrl key and hold for 0,06 seconds and release
    Say, 'ctrl'
End Condition

The "When I press button" option for the command should have everything unchecked, and no other commands should be set to use that button.

700 milliseconds is the default threshold time for a long press, so you'd want to change that if you changed the corresponding option on the "Hotkeys" tab of the VoiceAttack options window

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Multiple controls on one or two joystick buttons
« Reply #11 on: April 30, 2021, 04:21:14 AM »
Thank you Pfeil,
I will try this.
For the 700ms, I didn't touch it.
I will give you the result of my tests as soon as I have been able to work on it more assiduously.
Have a nice day.
Best regards.
Edgar