Author Topic: Use of Variable Keypress help  (Read 1621 times)

bootrossbootross

  • Newbie
  • *
  • Posts: 11
Use of Variable Keypress help
« on: October 12, 2020, 03:35:54 AM »
Hi all, new user so please be kind :)

best way to explain my dumbness is with an example, as Im sure this is a simple problem.

I want to say "jump"and have the command result in a jump, but in game the jump button is configuired differently for different users - ie one has it as X and one has it as O.

Is this possible to do using the variable keypress command?  If so, how?

Can it also take into account somone might use mouse/keyboard (so maybe "space" is jump in game) and others might use controllers?

I dont get it from reading the manual and I cant find a topic that spells this out.

So basically I just want a command that works whilst recognising the actual game input key may be different.

thanks!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Use of Variable Keypress help
« Reply #1 on: October 12, 2020, 03:42:45 AM »
Is the intent to have the user speak a command to set which key they're using? That could be done with the variable keypress action, yes.

This cannot work for controllers, however; The DirectInput/XInput APIs don't support the pressing of buttons on an existing controller like the keyboard does (this is not a VoiceAttack-specific limitation).

bootrossbootross

  • Newbie
  • *
  • Posts: 11
Re: Use of Variable Keypress help
« Reply #2 on: October 12, 2020, 07:12:06 AM »
Hi Mate,

I want to make a voice command that will work for a pacticular in game action regardless of the actual defined key control in the game.

IE default key in game for jump is "spacebar", one user has changed it in game to some other key (could be anything).

The way the manual reads this is the situation that variable keypress is used, but i do not understand how make it.

As for controllers - I have tried TheDRE profile in Iracing which is using variable keypress to be able to recognise that I have mapped in game key commands to my controller and the voice commands still work, so it seems like it is possible?

cheers

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Use of Variable Keypress help
« Reply #3 on: October 12, 2020, 07:27:20 AM »
You'll need some way to have your user input which keys they're using; There is no universal storage or API method for game controls, so you'd need a specific method for each game you want to support if you're looking to automate getting the ingame control settings.


VoiceAttack can detect button presses on joystick devices, however that won't be suitable for all games as many don't allow simultaneous keyboard and controller input (E.G. if you're moving with an analog stick and you use a keyboard control, you stop moving).

The variable keypress action by itself just takes literal text and interprets it as a sequence of keypresses; It's up to you to provide the relevant input in the form of a value stored in a text variable.

bootrossbootross

  • Newbie
  • *
  • Posts: 11
Re: Use of Variable Keypress help
« Reply #4 on: October 15, 2020, 03:23:59 AM »
Ok I think I understand now, thanks for patience!

The next obvious question for a dunce like me is how do you set up the text variables within VA - feel free to point me to the manual if thats where I can learn!

cheers

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Use of Variable Keypress help
« Reply #5 on: October 15, 2020, 03:40:50 AM »
The actual setting of variables is done using the appropriate "Set a" action, E.G. the "Set a Text Value" action.

To decide which value is set, you'll want to look into tokens like "{CMD}" and/or "{CMDSEGMENT:segment}", in combination with the "Begin a Conditional (If Statement) Block" action.
You'll likely also want to read up on "Dynamic command sections", as well as "Variable Keypress (Advanced)", and "Quick Input, Variable Keypress and Hotkey Key Indicators".

Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer, which contains information on those features.


These topics may also be useful:
https://forum.voiceattack.com/smf/index.php?topic=3500.0
https://forum.voiceattack.com/smf/index.php?topic=732.0