Author Topic: Trying to swap weapons saying "swap" using odd/even count to change button.  (Read 1080 times)

JP_

  • Newbie
  • *
  • Posts: 3
Hey guys,

I'm trying to streamline my setup (I have one arm) where I can say "swap" and VA will press "2", then say "swap" again and it'll press "1". That way I can have one word that just swaps between "1" and "2" on a loop.

I'm guessing it'll need ElseIf etc stuff? For EG

If "Swap" hasn't been said press "2"
If swap has been said once press "1"
If swap has been said equal number of times press "2"
If swap has been said an odd number of times press "1"

Hopefully that makes sense and is possible?

Thanks!

-JP

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
That is possible, yes.

You can use a condition with an Else action, a Boolean variable, and two keypress actions.


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

These topics may also be of use, in addition to the official documentation:
Control flow (If, Else, ElseIf, Loop, Jump) basics
Variables and tokens summed up

JP_

  • Newbie
  • *
  • Posts: 3
Hey Pfeil,

I have read through these already, as well as 20+ pages of your responses to other people and I think I've come to the conclusion that I just cannot seem to wrap my head around coding / programming language.

It's very odd as I'm a very robotic/logical person yet this code (which is the definition of logic) I just keep getting lost.

I don't suppose you have some time available to help me/others understand something like this? I'm sure it's simple I just don't understand even the first page in the help sections. It's almost as if you require some previous programming knowledge to join the dots together?

Either that or perhaps I'm just stupid haha though I did manage to code HTML websites as a child in notepad and program some controls onto a Behringer Controller.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Which part are you stuck on, specifically?

The command you are describing can be put together with of a total of six entries in the action list: a "Begin a Conditional (If Statement) Block" action, a keypress action, a "Condition Else" action, another keypress action, an "End a Conditional Block" action, and a "Set a True/False (Boolean) Value" action.

JP_

  • Newbie
  • *
  • Posts: 3
All of it to be honest. I don't even understand what you just wrote, I feel like I'm sat here looking at random words thrown together with someone else nodding at me saying "see this is easy".

Hyda_Scarface

  • Newbie
  • *
  • Posts: 4
i think with something like that your voice attack would have to know the starting position if you are in 1 or 2 and then keep track of where you are at in the cycle. i don't know much about doing commands with this program (trying to learn too)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
The original poster contacted the VoiceAttack Discord, where they were further assisted.

The command mentioned in my posts would look something like this in the action list, when completed:
Code: [Select]
Begin Boolean Compare : [Swapped] Equals False
    Press 2 key and hold for 0,05 seconds and release
Else
    Press 1 key and hold for 0,05 seconds and release
End Condition
Set Boolean [Swapped] to Toggle

As with any normal logical state that exists solely within VoiceAttack itself, this would indeed get desynchronized if the ingame state is changed through other means (E.G. restarting a level).
Though, given that there are only two possible states in this particular case, executing the command twice should alleviate that.

With more complex states, a separate command could be used to adjust it to the current ingame value.