Author Topic: Joystick Button Interaction  (Read 4242 times)

CrossWiseRanger

  • Newbie
  • *
  • Posts: 13
Joystick Button Interaction
« on: March 29, 2017, 06:22:12 PM »
I'm confused by the button interaction (or lack thereof) of two joystick buttons.

My command is initiated with Joystick 2 Button 11.  I want it to press the F1 key if a second button is being held down, my option button.

This code works, when second button is not active:

Code: [Select]
Begin Text Compare : [{STATE_JOYSTICK1BUTTON:4}] Equals '0'
    Press F1 key and hold for 0.1 seconds and release
    Write '[Blue] F1 Pressed' to log
End Condition

This code does not work even though the log shows "F1 pressed".

Code: [Select]
Begin Text Compare : [{STATE_JOYSTICK1BUTTON:4}] Equals '1'
    Press F1 key and hold for 0.1 seconds and release
    Write '[Blue] F1 Pressed' to log
End Condition

What am I missing about joystick button interaction?  Thanks.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Joystick Button Interaction
« Reply #1 on: March 29, 2017, 06:27:26 PM »
I assume you're testing this in a game; Have you tried changing F1 to "visible" keypress like "a", and running the command in notepad to see the output?

If you're holding down device 1's button 4, all of the actions within the conditional block should run, not just one of them. It may be you're not seeing the effect of the keypress because the joystick button(or a combination of both buttons) causes a conflict within the game(Are you sure button 4 isn't mapped to anything?).

CrossWiseRanger

  • Newbie
  • *
  • Posts: 13
Re: Joystick Button Interaction
« Reply #2 on: March 30, 2017, 07:37:07 PM »
The game is Digital Combat Simulator, DCS.

Thanks for the great debugging tip of sending visible output to notepad - worked.

Interestingly, the joystick combo works in the DCS game control setup page.  Doesn't work in game.

*****

Further testing found that if a joystick button is setup as a modifier in DCS, the button will be blocked - why this was not working.

I could use two buttons in VA, one as a modifier, and it would work.  Tried the same setup in DCS, and would work. Then tried again in VA, with one button still designated as a modifier in DCS, would not work.  Removed the modifier designation - and again would work in VA.

Does VA have a means of getting around this problem?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Joystick Button Interaction
« Reply #3 on: March 30, 2017, 08:47:34 PM »
Further testing found that if a joystick button is setup as a modifier in DCS, the button will be blocked
Does VA have a means of getting around this problem?
VoiceAttack should be able to see the button press without issue, however DCS will consider "modifier+F11" to be mapped to a different function than "F11".

You'll either have to map the "modifier+F11" combination to the same function as "F11" within DCS, or use a different button as the modifier for either VoiceAttack or DCS.

A third option is to use a keyboard key as your modifier(if you can find one that's not in use by DCS, not an easy task, I know) and have VoiceAttack conditionally determine whether to send it or not(depending on other button/keystates) when you press the joystick button(E.G. if you only press that button, use as modifier, but if the trigger is also held down, send a different non-modifier keypress instead).


It's not possible to stop the button press from going through to DCS, DirectInput doesn't support it.

CrossWiseRanger

  • Newbie
  • *
  • Posts: 13
Re: Joystick Button Interaction
« Reply #4 on: April 01, 2017, 08:46:01 AM »
I further determined with DCS that anytime a DCS modifier is active, other control buttons or keyboard keys would be blocked.  Wasn't expecting that!  Understand why would block those that use the modifier, but not all.

So, the answer is that all controls using a specific modifier have to be on one application or the other - DCS or VA.

I chose to put all on VA do to the increased flexibility provided.  For example:  one button can rotate through different views.  And, one button can both show the cursor and if continued to be pushed recenter the cursor.

Great product - Thanks.