Author Topic: Variables with a single command.  (Read 1893 times)

TactiCol

  • Newbie
  • *
  • Posts: 5
Variables with a single command.
« on: September 14, 2020, 12:02:41 AM »
I'm not sure what the correct terminology is within the software as I am new to it but, could anyone explain in simple terms how I would carry out the following.

When I say "Number" 1,2,3,4,5 etc to get it to function as a single command with multiple parts that would press 1 or 2 or 3 or 4 or 5 etc. I saw something along the lines of When I Say "Number [1 2 3 4 5]" {CMDSEGMENT:1} or whatever but I am not really sure what I am doing and where I enter the {CMDSEGMENT:1} aspect to the "number" command to make the numbers variable as a part of a single command.

I know this is probably a garbled example but, I'm hoping it makes sense to somebody :) If not, suppose I wanted to change gear in a racer but, did not want to create 6 individual gear commands but rather 1 command with all the gears as variables, how would I go about that? When I say gear 1,2,3 etc it will listen for gear and then the number of the gear after that. I hope that makes sense.

Thanks in advance for any help you can offer me. It would be much appreciated.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Variables with a single command.
« Reply #1 on: September 14, 2020, 08:21:57 AM »
Have you read the documentation on the features you're trying to use?

Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer and search for these (sub)sections:
  • "Dynamic command sections"
  • "Text (and Text-To-Speech) Tokens"
  • "{CMDSEGMENT:segment}"
  • "'Quick Input'"
  • "6 – Variable Keypress (Advanced)"
  • "'Set a Text Value'"
  • "Quick Input, Variable Keypress and Hotkey Key Indicators"

TactiCol

  • Newbie
  • *
  • Posts: 5
Re: Variables with a single command.
« Reply #2 on: September 15, 2020, 12:14:21 AM »
Have you read the documentation on the features you're trying to use?

I tried to read about it before I came here and it mentioned something about it being included later in the documentation. I did a quick scan read below that but could not find the relevant information. I don't have search functionality for the .pdf as I open it in a browser (I don't have any adobe stuff on my PC). That's why I came here as I didn't want to read the entire documentation to learn one function from it.

Are you able to help at all? Even the page number would be useful but, it would be even more helpful if you could give me an example of how it is put together. If that is too much for you to do right now or you don't have the time to help then no worries and thanks for trying. I will try and get a bit of help from someone else.

If anyone else could point me in the right direction that would be very much appreciated.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Variables with a single command.
« Reply #3 on: September 15, 2020, 08:58:57 AM »
Actually, Pfeil was pointing you in the right direction-   It seemed like you were on the right track and genuinely interested in knowing how to get something useful up and running, so Pfeil was giving you the locations of where to get the tools that you'll need (in lieu of just pasting a command - which might have been easier than looking up all those sections).

To search a PDF in a browser, simply press CTRL + F.  If you're using Chrome (well, probably anything other than Edge), you'll get bookmarks as well.

TactiCol

  • Newbie
  • *
  • Posts: 5
Re: Variables with a single command.
« Reply #4 on: September 15, 2020, 10:48:09 AM »
Actually, Pfeil was pointing you in the right direction-   It seemed like you were on the right track and genuinely interested in knowing how to get something useful up and running, so Pfeil was giving you the locations of where to get the tools that you'll need (in lieu of just pasting a command - which might have been easier than looking up all those sections).

To search a PDF in a browser, simply press CTRL + F.  If you're using Chrome (well, probably anything other than Edge), you'll get bookmarks as well.
I was appreciative of his input but, I did not know you could search .pdf files in a browser so I didn't really feel it was going to be of much use without reading the entire documentation. It's a fairly lengthy technical document so it's not something I wanted to do. I tend to grab snippets as and when required from documents of that nature. I only bought the software last week so I am new to it and reading and digesting the entire documentation would have been overwhelming to find one function that I actually want to implement. I wasn't being dismissive of his input in any way.

Thank you for making me aware that I can in fact search the .pdf as this will obviously help enormously in finding the relevant information.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Variables with a single command.
« Reply #5 on: September 15, 2020, 11:05:19 AM »
I'll elaborate a little:

"Dynamic command sections" documents the syntax for what you referred to as "Number [1 2 3 4 5]", which can be expressed more succinctly using numeric ranges (also documented in that section), too


"Text (and Text-To-Speech) Tokens" documents what tokens are, and how/where to use them

"{CMDSEGMENT:segment}" is a subsection of the latter, pertaining specifically to that token


"'Quick Input'" is one option for turning your numeric input into keypresses, assuming that's what you're looking to do; It is intended for typing out text

"6 – Variable Keypress (Advanced)" is another options for turning numbers into keypresses; It is intended for pressing specific keys

"'Set a Text Value'" is required for using variable keypresses

"Quick Input, Variable Keypress and Hotkey Key Indicators" are useful, though not necessarily required, for both Quick Input and variable hotkeys


Assuming what you're looking to do is speak a number and have VoiceAttack press a numeric keyboard key, the command will be relatively simple when put together, however there is most certainly value in understanding the individual components.

TactiCol

  • Newbie
  • *
  • Posts: 5
Re: Variables with a single command.
« Reply #6 on: September 18, 2020, 04:05:36 AM »
@Pfeil.

Thanks for trying and I am genuinely appreciative but, I have looked at that comment and reread it at least half a dozen times and it simply does not compute. I do have neurological issues that result in brain fog so perhaps that is playing it's part here. I was looking for a more ELI5 explanation to carry out what I thought would be a fairly simple task.

I'm not particularly interested in becoming a master of voice attacks coding and syntax and your explanation is probably more suited to someone that is. I basically wanted to group some commands together to keep things a bit tidier in my voice attack gaming profile and carry on with chilling out and doing a bit of gaming. I don't mean to be offhand with that or dismissive of your help but, that's basically the long and short of it.

To be clear what I was hoping to achieve would be something like saying the word Gear and that being a prefix for 1,2,3,4,5,6 and reverse. So when I say the word Gear it waits for the following variable (the 1,2,3,4,5,6 and reverse) before translating to a keypress.

Quote
Assuming what you're looking to do is speak a number and have VoiceAttack press a numeric keyboard key, the command will be relatively simple when put together, however there is most certainly value in understanding the individual components.

I don't disagree with you, particularly if a person is interested in utilising the software in a more complex way but, it's way beyond what I need or want to do right now. I'm a fairly busy guy with a business to run and a family to care for. The little bit of free time I do have, I like to spend doing a little gaming, usually in my favourite simulators (driving, farming, flight and trains).

An example of how the command is layed out would have been far more helpful for me tbh. That's not to be unappreciative  of the help you are trying to give me either. It's just that it's more shades of complexity where simplicity may have served a more useful purpose.

I'll just stick to single commands for now and revisit the issue another time. Thanks anyway.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Variables with a single command.
« Reply #7 on: September 18, 2020, 10:29:47 AM »
The addition of "reverse" changes things somewhat, as you'll need a condition to deal with that.

If your gears are on the numeric keys at the top of your keyboard, the command could look something like
Gear [1..6;reverse]
Code: [Select]
Begin Text Compare : [{TXTNUM:"{CMD}"}] Does Not Equal ''
    Set text [~key] to '{TXTNUM:"{CMD}"}'
    Press variable key(s) [~key] and hold for 0,02 seconds and release
Else
    Press R key and hold for 0,02 seconds and release
End Condition

If they're on the numpad instead, it could look like
Code: [Select]
Begin Text Compare : [{TXTNUM:"{CMD}"}] Does Not Equal ''
    Set text [~key] to '[NUM{TXTNUM:"{CMD}"}]'
    Press variable key(s) [~key] and hold for 0,02 seconds and release
Else
    Press R key and hold for 0,02 seconds and release
End Condition

Otherwise it'd have to look like
Code: [Select]
Begin Text Compare : [{CMD}] Ends With '1'
    Press A key and hold for 0,02 seconds and release
Else If Text Compare : [{CMD}] Ends With '2'
    Press B key and hold for 0,02 seconds and release
Else If Text Compare : [{CMD}] Ends With '3'
    Press C key and hold for 0,02 seconds and release
Else If Text Compare : [{CMD}] Ends With '4'
    Press D key and hold for 0,02 seconds and release
Else If Text Compare : [{CMD}] Ends With '5'
    Press E key and hold for 0,02 seconds and release
Else If Text Compare : [{CMD}] Ends With '6'
    Press F key and hold for 0,02 seconds and release
Else
    Press R key and hold for 0,02 seconds and release
End Condition


If you literally want the command to wait after you say "Gear", you can use the "Wait For Spoken Response" action, E.G.
Gear
Code: [Select]
Wait for spoken response: '[1..6;reverse]'
Begin Text Compare : [{TXTNUM:~response}] Does Not Equal ''
    Set text [~key] to '{TXTNUM:~response}'
    Press variable key(s) [~key] and hold for 0,02 seconds and release
Else
    Press R key and hold for 0,02 seconds and release
End Condition

TactiCol

  • Newbie
  • *
  • Posts: 5
Re: Variables with a single command.
« Reply #8 on: September 22, 2020, 12:33:04 PM »
Thank you for your response and ongoing help. It truly is appreciated.

The examples you have given above are far more helpful in assisting me to visualise it. I will have a go at it tonight and see how I get on.

Again, thank you very much for taking the time to provide such a detailed response.