Author Topic: How to get a specific response to the word {CMD_BEFORE}  (Read 3017 times)

LikeDarkness13

  • Guest
How to get a specific response to the word {CMD_BEFORE}
« on: December 16, 2017, 01:04:17 AM »
'test number [*ten*; *nine*; *seven*]' i have no idea how to do this... so if i say 'test number ten' i need get text-to-speech answer 'ten' if 'test number nine' answer 'nine'. Just trying to find better way than create 'test number ten', 'test number nine' and so on for every respond. So what should i do with this {CMD_BEFORE}? If you dont mind i need instruction with all basics xd                     
P.S. sry, for my eng

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #1 on: December 16, 2017, 04:03:33 AM »
test number [1..10]

Say, '{CMDSEGMENT:1}'
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

LikeDarkness13

  • Guest
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #2 on: December 16, 2017, 08:07:02 AM »
Its my fault, i mean word not number and idk where to place command xD I start full use of voice attack 1 day ago xD I need answer on specific word, like 'When i say: [Hi;Hey;Hello] Jess' and get answer 'Hi' on 'Hi Jess' or 'Hey' on 'Hey Jess' i hope you get it, i rly bad at this :D I could create new command on every sentence like 'When i say: Hi Jess' answer will be 'Hi' and then create another command like 'Hey Jess' answer 'Hey'. But i fond {CMD_BEFORE} and i just need know how to use it, maybe '[*Hi*;*Hey*] Jess', something like this and then somehow use token {CMD_BEFORE} somewhere, i have no idea. Hope i can get help with this.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #3 on: December 16, 2017, 10:01:02 AM »
If what you want is to be able to speak a specific variation of a phrase, and determine which variation was spoken within the command, you can use the "{CMD}" token(to get the entire spoken phrase), or the "{CMDSEGMENT:}" token(to get a specific part of the spoken phrase).

E.G. if you have a "When I say" "[Hi;Hey;Hello] Jess", you can do the following:
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'Hi'
    Say, 'You said Hi'
Else If Text Compare : [{CMDSEGMENT:0}] Equals 'Hey'
    Say, 'You said Hey'
Else
    Say, 'You said Hello'
End Condition
The first branch checks whether "Hi" occurs anywhere in the spoken command, the second checks whether the dynamic section chosen was exactly "Hey", the third just assumes that if neither of the above were chosen, it must logically be "Hello".


You're combining a number of concepts here: Dynamic Command Sections, Dictation Wildcards, and a Dictation wildcard-only token.

If you're defining all variations of the exact phrases you wish to speak, you don't need wildcards. Something like "*Hi jess" would allows you to speak "oh there you are hi jess" and potentially have the command recognized(though, because this relies on dictation, it's not very accurate in practice).
The "{CMD_BEFORE}" token would, in the above example, return "oh there you are", as that's the dictation before the actual command.

Dynamic Command Sections, I.E. the part between the square brackets("[" and "]") will automatically extrapolate the given variations and pass them to the speech engine.
The chosen variation can, as shown above, be determined using the "{CMDSEGMENT:}" token(which can only be used when there are dynamic command sections in the command name), or the "{CMD}" token(which always contains the entire spoken phrase when the command is triggered by speech).

LikeDarkness13

  • Guest
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #4 on: December 16, 2017, 12:19:26 PM »
thanks :D

But how to make this '[Jenny;Jerry;Jonny;] [and;] bonny [hi; hey; Hello]' work?
Example: 'Jonny and bonny hi' respond 'Jonny here, hi', but if i say 'bonny hi' response would be just 'hi'

                                                                                                                                                                                                       
                                                         P.S. [and;] needed there to better understand how its work. Its 2 day i start using this program like this and its so confusing

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #5 on: December 16, 2017, 02:14:56 PM »
There are a number of ways to make that happen, but you'll have to understand the fundamental building blocks first. Perhaps this topic provides some insight.


To make your example work, it could be as simple as
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'Jonny'
    Say, 'Jonny here, hi'
Else
    Say, 'hi'
End Condition
But that's not very flexible.

One step further is to use the "{CMDSEGMENT:}" token to dynamically alter what is said by TTS:
Code: [Select]
Begin Text Compare : [{CMDSEGMENT:0}] Does Not Equal ''
    Say, '{CMDSEGMENT:0} here, hi'
Else
    Say, 'hi'
End Condition
If you speak "jenny and bonny hi" it'll say "jenny here, hi", if you speak "jerry and bonny hi" it would say "jerry here, hi", etc..

If a dynamic command section is not used in the spoken phrase, the "{CMDSEGMENT:}" token will return ""(blank) for that section, so the section number is always the same no matter how many are spoken(do remember that it's zero-indexed though, the first section is number 0, the second number 1, and so on).

LikeDarkness13

  • Guest
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #6 on: December 17, 2017, 12:41:08 AM »
Thank you,
I happy i bought this program not only because i have amazing virtual companion, but because i fond this amazing community.
                                                                                                           
                                                                                                                          You are very helpful :3

LikeDarkness13

  • Guest
Re: How to get a specific response to the word {CMD_BEFORE}
« Reply #7 on: December 19, 2017, 12:16:54 PM »
This is what i ended up with
When i say: [if i'm walking down alley; if i'm walking in the sky; if i'm doing something funny; or just doing something right]
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'down alley'
    Say, 'some dude is so fekked up'
Else If Text Compare : [{CMD}] Contains 'in the sky'
    Say, 'some angel tell's me if i'm fekked up'
Else If Text Compare : [{CMD}] Contains 'something funny'
    Say, 'Fun, hah?'
Else If Text Compare : [{CMD}] Contains 'something right'
    Say, 'all gonna be alright'
End Condition
xD just test, but all works.
                                                                                                                                                                                P.S. nice censor xD
« Last Edit: December 19, 2017, 12:21:01 PM by LikeDarkness13 »