Author Topic: Multiple Button Sequence for Activation?  (Read 1375 times)

Jeimuzu

  • Newbie
  • *
  • Posts: 2
Multiple Button Sequence for Activation?
« on: May 01, 2020, 07:17:46 PM »
I'm trying to set up pip management in Elite Dangerous. I'd like to be able to set the activation command to be multiple buttons, such as POV up, then POV left. It seems that VA only allows simultaneous button presses. For the actual command to be carried out, you can record what I'm trying to do. Is there a way to do this for the activation trigger ?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4785
  • RTFM
Re: Multiple Button Sequence for Activation?
« Reply #1 on: May 01, 2020, 07:31:25 PM »
You can use the "Device State" tab of the "Begin a Conditional (If Statement) Block" or "Loop Start" actions to check whether a given joystick button is pressed.

If you trigger a command using the first action in your sequence (E.G. POV 1 up), you can use a waiting loop so you have time to release the trigger button and press another button, E.G.
Code: [Select]
Start Loop While :  Joystick 1 POV 1 Button 1 Is Pressed
End Loop
Start Loop While :  Joystick 1 No Button Is Pressed
End Loop
Begin Device State Check :  Joystick 1 POV 1 Button 2 Is Pressed
    Write [Blue] 'Button sequence detected' to log
End Condition

The first loop will wait for you to release the button the triggered the command (substitute the correct button numbers for your device), then the second loop will wait until another button is pressed, the condition then checks whether that button is the second one in the sequence, and will execute the actions within its begin and end actions.

Do note that the loops will keep running until another button is pressed; If you want to use a timeout to stop the second loop after no button has been pressed within the allotted time, you can do something like
Code: [Select]
Start Loop While :  Joystick 1 POV 1 Button 1 Is Pressed
End Loop
Set date [~timeout] to [~timeout] plus [1000] milliseconds
Start Loop While : Joystick 1 No Button Is Pressed OR [~timeout] Is Greater Than Current Date/Time
End Loop
Begin Device State Check :  Joystick 1 POV 1 Button 2 Is Pressed
    Write [Blue] 'Button sequence detected' to log
End Condition

Jeimuzu

  • Newbie
  • *
  • Posts: 2
Re: Multiple Button Sequence for Activation?
« Reply #2 on: May 01, 2020, 09:31:42 PM »
This is all way over my head, so I just set up 3 individual commands, executing multiple button presses each. There's not really a reason to combine them anyway, since I'd still need to press the same amount of buttons, and I get the same end result.

Thanks for the quick response though.