Author Topic: Please someone explain to me what suffix and preffix do and also i need help wi  (Read 22477 times)

axonMagnus

  • Jr. Member
  • **
  • Posts: 62
Explain to me like i am 5 , what is a {PREFIX} , {SUFFIX} and wild card ?

Also please help me with this command .The command 
Code: [Select]
[unit 1,unit 2, unit 3, unit 4] assign to team [red,green,blue,yellow,white] so for example i would say ""unit 1 assign to team red"" and then run a sound  text to speech command saying

Code: [Select]
{CMD} assigned to team {CMD} and the output would be ""unit 1 assigned to team red""


And with that process i would like to have something that can be scale for example to something like this

I would say ""unit 1 mount vehicle 2 driver seat"" and the command would look like this
Code: [Select]
[unit 1; unit 2] [mount;formation] [echlon; vehicle 2] [driver;shotgun]
so i would have in essence 16 possibilities :D and millions of internet points to the person who figures what game am designing this for :D 

Quote
Doubt kills more dreams than failure ever will


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Explain to me like i am 5 , what is a {PREFIX} , {SUFFIX} and wild card ?

I don't know what specifically you don't understand, so I'll quote the documentation. I hope that it clarifies things for you:

Quote
Prefixes and suffixes only execute when they are used together in a voice command (which means that they will not execute on their own). When they are executed together, the actions from the prefix are executed first, followed by the actions in the suffix. This is handy if you want to create a lot of similar commands, without copying and modifying over and over again.


As an example, lets use the actions found in a racing game. Let's say that the races potentially have up to 100 drivers. If you wanted to create commands to eject any one of the drivers from a race, you would need to create 100 commands (eject driver 1, eject driver 2, eject driver 3, etc.). Next, if you wanted to mute any one of those drivers you would need to create another 100 commands (mute driver 1, mute driver 2, mute driver 3, etc). For every action that involves drivers, you would need to create another 100 commands. To solve this with prefixes and suffixes, you would first create the suffixes for the 100 drivers (yeah... I know that's a lot). The suffix actions would be something like this (for driver 82):


Press 8

Release 8

Press 2

Release 2

Press Enter

Release Enter


Once you have your suffixes lined up, you can then create as many prefixes as you need to work with them. For, 'mute driver', you create a command and designate it as a prefix. Its actions would look like this:


Press m

Release m

Press u

Release u

Press t

Release t

Press e

Release e

Press Space

Release Space


When you say, 'mute driver 82', all the actions from, 'mute driver' will be executed first, followed by the actions in suffix '82'. You only have to create one prefix and it is automatically paired with all of the available suffixes.


Prefix/Suffix Group -

Indicate a group name for your prefix or suffix to have the pairing of the prefix and suffix to occur only within that group. For instance, you can have a group called, 'taunt' where all of the suffixes contain something funny to say when you mute or eject a driver:)



{PREFIX} - If an executing command is composite (where there is a prefix and a suffix), this token will be replaced with the prefix portion of the command. If called in a non-composite command, this will result in a blank string.

{SUFFIX} - If an executing command is composite (where there is a prefix and a suffix), this token will be replaced with the suffix portion of the command. If called in a non-composite command, this will result in a blank string.
Quote
There is a somewhat unsupported* feature in VoiceAttack's 'When I say' feature.

You can use, 'wildcards' around the phrases to indicate, 'contains', 'starts with' and 'ends with'.

So, let's say you have a spoken phrase 'attack'. Let's also say that you want to execute your command if the word, 'attack' is included in any spoken phrase. To indicate to VoiceAttack that you want the, 'attack' command to execute any time it is contained in a phrase, you simply put asterisks around the phrase, like so : *attack*.


If you want to indicate that you want the, 'attack' command to execute if the spoken phrase starts with the word, 'attack', just put an asterisk at the end, like so : attack*.

This way, you can say, 'attack the enemy' and VoiceAttack will execute the 'attack' command. If you say, 'I would like to attack the enemy', the 'attack' command will not be executed, since the word, 'attack' is not at the start of the phrase.


On a similar note, if you only want, 'attack' to be executed if the word, 'attack' is at the end of the phrase, put the asterisk at the beginning, like so: *attack.


VoiceAttack will execute the wildcard commands in the order they are spoken in your phrase. So, if you have '*rocket*' and '*ship*' and '*attack*' as commands, and you happen to say, 'I would like to attack the ship with my rockets', VoiceAttack will execute 'attack', then, 'ship' and then 'rocket' in that order, but all in rapid succession (which means they will all be executing at the same time, so be careful. To control this type of rapid execution, see the 'Allow other commands to be executed while this one is running' feature on the Command screen).

Commands will not repeat with wildcards. If you have commands, '*rocket*' and, '*ship*' and, '*rocket ship*' and you say, 'I want to take a ride in my rocket ship', VoiceAttack will execute the command, 'rocket ship' and not 'rocket' and 'ship'. Also, if you say, 'rocket rocket rocket rocket rocket rocket rocket rocket rocket', the 'rocket' command will only be executed once.


* The reason it is 'somewhat unsupported' is basically because it is not a terribly reliable feature and was added as an attempt to give a little bit more flexibility, especially in the areas of immersion. Your mileage may vary. Good luck, captain!



{CMD_BEFORE} - When using wildcards in spoken phrases, this is the text that occurs before the wildcard phrase. For example, if using, '*rocket*' as your wildcard phrase and you say, 'i am going for a ride in my rocket ship' {CMD_BEFORE} will contain, 'i am going for a ride in my' and {CMD_AFTER} will contain 'ship'. This token does not have to be set prior to using.


{CMD_AFTER} - When using wildcards in spoken phrases, this is the text that occurs after the wildcard phrase.


The command 
Code: [Select]
[unit 1,unit 2, unit 3, unit 4] assign to team [red,green,blue,yellow,white] so for example i would say ""unit 1 assign to team red"" and then run a sound  text to speech command saying

Code: [Select]
{CMD} assigned to team {CMD} and the output would be ""unit 1 assigned to team red""


And with that process i would like to have something that can be scale

"[unit 1;unit 2;unit 3;unit 4] assign to team [red;green;blue;yellow;white]"
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'unit 1'
    Press 1 key and hold for 0,06 seconds and release
    Set Text [UnitNumber] to 'Unit 1'
Else If Text Compare : [{CMD}] Starts With 'unit 2'
    Press 2 key and hold for 0,06 seconds and release
    Set Text [UnitNumber] to 'Unit 2'
Else If Text Compare : [{CMD}] Starts With 'unit 3'
    Press 3 key and hold for 0,06 seconds and release
    Set Text [UnitNumber] to 'Unit 3'
Else
    Press 4 key and hold for 0,06 seconds and release
    Set Text [UnitNumber] to 'Unit 4'
End Condition
Begin Text Compare : [{CMD}] Ends With 'red'
    Press Left Shift+A keys and hold for 0,06 seconds and release
    Set Text [TeamColor] to 'red'
Else If Text Compare : [{CMD}] Ends With 'green'
    Press Left Shift+B keys and hold for 0,06 seconds and release
    Set Text [TeamColor] to 'green'
Else If Text Compare : [{CMD}] Ends With 'blue'
    Press Left Shift+C keys and hold for 0,06 seconds and release
    Set Text [TeamColor] to 'blue'
Else If Text Compare : [{CMD}] Ends With 'yellow'
    Press Left Shift+D keys and hold for 0,06 seconds and release
    Set Text [TeamColor] to 'yellow'
Else
    Press Left Shift+E keys and hold for 0,06 seconds and release
    Set Text [TeamColor] to 'white'
End Condition
Say, '{TXT:UnitNumber}, assigned to team {TXT:TeamColor}'

  • I would have grabbed the values from the actual spoken command, but there's currently no way to get words from a string(as using SUBSTRING would require exact lengths).
  • Keypresses are placeholder, of course, but they should illustrate the concept.
  • If you're adding more elements, you should use "Contains", instead of "Ends With"(E.G. "Else If Text Compare : [{CMD}] Contains 'green'").

Note that the structure of the command is usually dictated by the output you're trying to produce. I don't know which key combinations do what in your application, so I can't guarantee this will adapt to your needs.


millions of internet points to the person who figures what game am designing this for :D
Solitaire?
« Last Edit: June 04, 2016, 09:40:02 AM by Pfeil »

IceBadger

  • Posts: 3
millions of internet points to the person who figures what game am designing this for :D 

Seems like ArmA 3 (or 2 or 1, or the original Operation Flashpoint, or even VBS1/2, they are all mostly the same :P )

axonMagnus

  • Jr. Member
  • **
  • Posts: 62
its good to be back , i forgot that we dont get notifications on forums :( , sorry am just repling noww ,,thank you very much my good sir you helped me big time managed to make something beautiful with arma 3 :D , i have managed to control some function of a squad :D , thanks you very much i aprec9iate it .

axonMagnus

  • Jr. Member
  • **
  • Posts: 62
millions of internet points to the person who figures what game am designing this for :D 

Seems like ArmA 3 (or 2 or 1, or the original Operation Flashpoint, or even VBS1/2, they are all mostly the same :P )

yes indeed my good sir its arma 3 :D you nailed it

Gangrel

  • Caffeine Fulled Mod
  • Global Moderator
  • Full Member
  • *****
  • Posts: 216
  • BORK FNORK BORD
its good to be back , i forgot that we dont get notifications on forums :( , sorry am just repling noww ,,thank you very much my good sir you helped me big time managed to make something beautiful with arma 3 :D , i have managed to control some function of a squad :D , thanks you very much i aprec9iate it .

Click the profile button at the top of the page, the mouse over modify profile, and choose notifications from that menu. You can then tweak the settings for when you get notified of stuff there.

you can also click an option at the top of a topic to be notified of replies even if you are not posting on that thread.

Saiasanc

  • Guest
@Pfeil - Can you go into any further detail? The documentation doesn't give any examples of how to use prefixes and suffixes in commands. 

For example, I have a prefix called "player" that types the word player and then a space. I also have two suffixes of "5" with Enter and "10" with Enter.  I want to set up a command called "volume" that uses the prefix (player) then types the word "volume" with a space afterwards, then chooses one of the two suffixes based on what I say.  So let's say I want to set the player volume to 10, I would say "player volume 10".  I can't seem to figure out how to get this to work.  I have the prefix and two suffixes in the same prefix/suffix group.  I just don't know how to get it to work. When I say "player volume 10" all I see in the log is:

Quote
Unrecognized : 'player volume 10'

I have tried putting the {PREFIX} and {SUFFIX} tokens in the "when I say" area.  I have also tried to instead put them in as Quick Input like so:

Quote
{PREFIX}volume {SUFFIX}

The reason I want to do it this way is because the "player" prefix can be used in several of my commands that do not pertain to volume. Also the 5 and 10 suffixes can be used with other commands as well.

But nothing seems to work.  Any ideas/suggestions?

--Sai

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM

Commands consisting of a prefix and a suffix are always two parts, no more, no less. I've answered this before here.


Personally, I don't bother with prefixes and suffixes. I find it much simpler to have self-contained commands that use conditions to handle multiple options:

"[player;someone else] volume [5;10]"
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'player'
    Quick Input, 'player '
Else
    Quick Input, 'someone else '
End Condition
Quick Input, 'volume '
Begin Text Compare : [{CMD}] Ends With '5'
    Quick Input, '5'
Else
    Quick Input, '10'
End Condition

Saiasanc

  • Guest

Commands consisting of a prefix and a suffix are always two parts, no more, no less. I've answered this before here.


Personally, I don't bother with prefixes and suffixes. I find it much simpler to have self-contained commands that use conditions to handle multiple options:

"[player;someone else] volume [5;10]"
Code: [Select]
Begin Text Compare : [{CMD}] Starts With 'player'
    Quick Input, 'player '
Else
    Quick Input, 'someone else '
End Condition
Quick Input, 'volume '
Begin Text Compare : [{CMD}] Ends With '5'
    Quick Input, '5'
Else
    Quick Input, '10'
End Condition

So this is actually going to be used to control the volume of the youtube player I use for streaming. The command is 'ytp volume [number]' where number is anything from 1 to 100.  Could I do this then?

"volume [1...100]"
Code: [Select]
Quick Input, 'ytp volume '
Begin Text Compare : [{CMD}] Ends With '5'
    Quick Input, '5[ENTER]'
Else
    Quick Input, '10[ENTER]'
End Condition

But with more compares from 1 - 100 so I can set the volume to whatever I want?  The only problem I see is that in the post you linked, it references an "Else If". But I don't see a way to add that. There is only "Else" or "Begin a Conditional (If Statement) Block".  So I am confused.

Just trying to wrap my head around how these more advance functions work. Thanks for all your help!

--Sai

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
There's a reason I asked you whether you were using the beta in this topic; Quite a few features have been added since the last release version(Gary is working on updating it, currently), including "Else If".


If you're doing numeric input, it makes more sense to isolate and use the number directly:
Code: [Select]
Set Text [CMD] to '{CMD}'
Quick Input, 'ytp volume {TXTNUM:CMD}'
You need to turn the "{CMD}" token into a variable because "{TXTNUM:}" doesn't support tokens(yet).

In the beta at least, you'll get a warning message, as "volume [1...100]" will add 100 different phrases to the speech engine.
If you're not using a large profile, or don't notice a difference in performance, this isn't an issue.
Otherwise, consider the granularity you need(E.G. [10;20;30;40;50;60;70;80;90;100], which only adds 10 commands).
« Last Edit: June 13, 2016, 01:38:03 PM by Pfeil »

Saiasanc

  • Guest
Okay finally figured it out. Using {CMD} did not work. So I went with the following, in case anyone wants to try something similar:

When I say:  'volume *' (where * == a number from 1 - 100)
Code: [Select]
Set Text [CMD] to '{CMD_AFTER}'
Quick Input, 'ytp volume {TXTNUM:CMD}[ENTER]'

This, combined with sending the command to the proper process, correctly sends the command to set the volume no matter what number I say after 'volume'. It will not process properly in my bot if you say anything other than a number or if you say a number lower than 1 or higher than 100.  But I am not too concerned with that occurring at this time.

Thank you again, @Pfeil, for all your help and suggestions!

--Sai

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Using {CMD} did not work.

Because for whatever reason, you switched from prefix/suffix to using wildcards. "{CMD}" will most assuredly work with your original specifications.


The main reason for using "[1..100]" in a command name is to aid recognition.
The speech engine often has difficulty recognizing what is essentially dictation(which means there are thousands of possibilities, not just the numbers you're looking to speak), as opposed to having 100 phrases to differentiate.

It also means the command will not execute(and thus type unrecognisable instructions to your "bot"), if there is no number within the range specified.

Saiasanc

  • Guest
Using {CMD} did not work.

Because for whatever reason, you switched from prefix/suffix to using wildcards. "{CMD}" will most assuredly work with your original specifications.


The main reason for using "[1..100]" in a command name is to aid recognition.
The speech engine often has difficulty recognizing what is essentially dictation(which means there are thousands of possibilities, not just the numbers you're looking to speak), as opposed to having 100 phrases to differentiate.

It also means the command will not execute(and thus type unrecognisable instructions to your "bot"), if there is no number within the range specified.

Okay I went back and re-read your previous post.  I apparently overlooked the following:

Quote
In the beta at least, you'll get a warning message, as "volume [1...100]" will add 100 different phrases to the speech engine.
If you're not using a large profile, or don't notice a difference in performance, this isn't an issue.
Otherwise, consider the granularity you need(E.G. [10;20;30;40;50;60;70;80;90;100], which only adds 10 commands).

The [1...100] was not working and kept giving a message such as "Unrecognized : volume XX" where the XX was the number I was speaking (10, 20, etc.).  But when I changed to only [10;20;30;40;50;60;70;80;90;100] instead, it works like a charm.  I really don't see a need to adjust the volume in finer increments than 10. So this works just fine.

I just started using VA a couple of days ago. And although I have tried reading through the documentation, it is still quite confusing to put together more advanced commands. So I really appreciate your time and patience in helping with these issues. Thank you!

--Sai

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
I didn't catch this at the time:
The [1...100] was not working and kept giving a message such as "Unrecognized : volume XX" where the XX was the number I was speaking (10, 20, etc.).

In the first instance I must have copied the dynamic section straight out of the quote:
"volume [1...100]"
Whereas in the second I did get it right:
"[1..100]"

The difference is "..." vs "..". The syntax calls for two periods, not three, which is why the command was not recognized.


As an aside, from v1.6.1.20 onward, you can use "[1..10,10]" instead of "[10;20;30;40;50;60;70;80;90;100]".