Help for tokens please!

612 views
Skip to first unread message

Mat M

unread,
Sep 1, 2015, 7:47:32 AM9/1/15
to VoiceAttack
Hello

I've a beginner question here...

I've searched trough the forums and the manual, but I don't understand how to use tokens.

How do I create/use them?

Thanks for the help


PS: English is not my native language, sorry for potential mispelling or mistakes.

Luca D

unread,
Sep 1, 2015, 10:39:25 AM9/1/15
to VoiceAttack
Simply put, a token is an dynamic alias for something else: any time you create a command that evaluates an expression (so, a condition block, printing something on the log, saying something with Text-to-speech, loading a sound file, sending a value to a plugin, you name it...), instead of putting a FIXED value in your command, you can put a token, and (at runtime) VA will then substitute that with the corresponding value.

You don't create tokens per se, you use those available, the meaning of each one described in the help file... however, since tokens like {TXT:xxx} and {COND:yyy} return custom condition values, that means that by creating a Condition/TextVariable somewhere in your commands, you are also implicitly creating a custom token too,l to use in the same command or elsewhere.

Mat M

unread,
Sep 1, 2015, 10:47:58 AM9/1/15
to VoiceAttack
Many, many thanks!

Gary

unread,
Sep 4, 2015, 5:06:27 PM9/4/15
to VoiceAttack
In the latest beta, I updated the documentation a bit for tokens (mostly for Zephy ;)) ... not sure how helpful it is yet ;)

Gary 

Gary

unread,
Sep 4, 2015, 5:19:13 PM9/4/15
to VoiceAttack
From the help document :

Text (and Text-To-Speech) Tokens
A VoiceAttack Token is a tag that can be used as a placeholder to represent a value in places that use text.  Tokens are surrounded by curly brackets {  } and will always contain a title that is case-sensitive :  {DATE} or {CMD} or {CLIP}.  Tokens started their life in VoiceAttack for use in Text-To-Speech (TTS).  Over time, the uses for tokens grew and now they can be used in all sorts of places that require text, such as file paths for launching apps and use in conditional statements.  Some tokens you may use a lot, others you may never use at all.  Some are simple (like {DATE} ) and some are way out there (like {EXP} ). An example of how to use the first token ( {TIME} ) is below.  It was used in TTS to help indicate the local time to the VoiceAttack user.

“The current time is now {TIME}”. 

This value was put in the, 'Say Something with Text-To-Speech' action.  When the action is executed, VoiceAttack replaces the {TIME} tag with the local time (24 hour clock) :

“The current time is thirteen hundred hours”.

A variation of the {TIME} token is {time} (notice the lower case).  This token will be rendered as a 12 hour clock, so, “The current time is now {time}” would be rendered as “The current time is now one o'clock” when the action is executed. 

Some tokens are a little bit more complicated (or flexible, depending on how you look at it) and contain parameters.  An example of this would be the {RANDOM:lowValue:highValue} token.  The purpose of this token is to generate a random number within a range. Notice that this token has TWO parameters : lowValue and highValue to represent the lower and upper boundaries of the range (I believe its first use was to roll virtual, 'dice').  Notice also that the parameters are separated from the title (and other parameters) by colons.  As an example, let's say we want to generate a random number between 10 and 20.  The token would look like this: {RANDOM:10:20}.

Using Text-To-Speech, your action could use the following statement :

“I am generating a random number and it is {RANDOM:10:20}”. 

When the action is executed, VoiceAttack will generate the random number and replace the tag, so the result would be something like, “I am generating a random number and it is 16”.

There are some tokens that take a variable name as a parameter, such as {TXT:variableName}.  When VoiceAttack encounters a token that accepts variable names as parameters, it replaces the tag with the value in that variable.  In the case of {TXT:variableName}, VoiceAttack will get a text variable's value.  {INT:variableName} will get an integer variable's value.  {BOOL:variableName} will get a boolean variable's value (and so on).  Let's say you set up a text variable called, 'myText' to have a value of, 'Dave'. The token you would use to get the value from 'myText' would be {TXT:myText}.  You could
use the token in a Text-To-Speech statement such as this:

“I'm sorry, {TXT:myText}, I'm afraid I can't do that.”  When the action is executed, the rendered statement would be, “I'm sorry, Dave, I'm afraid I can't do that.”  Then, if you set 'myText' to have a value of, 'Sally' and execute the statement again, the rendered statement would be, “I'm sorry, Sally, I'm afraid I can't do that.”.

Note:  VoiceAttack's tokens work even when there are multiple entries for random TTS statements.  Remember, tokens are case-sensitive...  {Time} will not be processed properly, but, {TIME} or {time} will.

////////////////////////////////////////////////////////////////////

Sketch Ben

unread,
Sep 9, 2015, 4:20:12 PM9/9/15
to VoiceAttack
Also new to VA, so this was very helpful. Would someone be able to provide me with an example of the prefix or suffix tokens in use?

Much thanks in advanced

wiesel

unread,
Sep 9, 2015, 5:40:18 PM9/9/15
to VoiceAttack
Hi Sketch Ben,

this video shows how the prefix-suffix commands works.
Now you can use the token to get the prefix or the suffix part of these commands.

example: the cmd PREFIX: "Wing 2", the cmd SUFFIX: "attack"
now we want an acoustic response: Say, 'confirmed, {PREFIX} attacking'
 
Hope that is useful.
Message has been deleted

Mat M

unread,
Sep 12, 2015, 1:02:36 PM9/12/15
to VoiceAttack


Hey

Thanks a lot for the help!

I've another question:
Is there a way to make lists?

e.g."wingmen 1,2,5 eat that pizza"

For now the syntax I've tried is this one:
"wingmen [1..20] [1..20] [1..20] eat that pizza"
And I'm using conditions to select wingmen ingame.

it works, BUT
This seems to be not optimized for this type of task... If I try to make a selection of, let's say, 6 wingmen in a list of 20, ("wingmen [1..20] [1..20] [1..20] [1..20] [1..20] [1..20]" ), then VA freezes (too many commands to create I guess), so I've got to kill the process in task manager.

I've tried to use prefixes but it seems impossible to chain them. (could be a good idea to implement this! ;))

Any help welcome!

Thanks

Mat M

unread,
Sep 13, 2015, 4:42:24 PM9/13/15
to VoiceAttack
Ok looks like I could find a way to do this with wildcards and token {CMD_BEFORE}
Will do some tests when I'll have some time.

Mat M

unread,
Sep 17, 2015, 5:11:01 AM9/17/15
to VoiceAttack
Using wilcadrs and token {CMD_BEFORE} doesn't help me. VA does not recognize the commands I say.

e.g if I make a command "wingmen 1 and 2 eat that pizza", everything is fine, VA undersands perfectly.
But If I make a wildcard "*eat that pizza " and use {CMD_BEFORE} to get the wingmen selection, and say "wingmen 1 and 2 eat that pizza" VA does not recognize "eat that pizza" as expected.
Strange...

As I feel a little bit alone on this topic, should I create a new one to talk about this?

Thanks

Gary

unread,
Sep 22, 2015, 1:21:27 AM9/22/15
to VoiceAttack
Hi, Mat.

I've created a command exactly as you've said, but it seems like it is working for me.  Understand that when using wildcards, there is going to be a slight degradation of recognition accuracy since you are not using exact commands.  It will boil down to a properly trained speech engine as well as making sure you have an adequate mic and a quiet room and all the other stuff that goes into reliable recognition.

Gary
Reply all
Reply to author
Forward
0 new messages