Author Topic: Command confirmation not working  (Read 2322 times)

Bazmack

  • Newbie
  • *
  • Posts: 21
Command confirmation not working
« on: July 05, 2019, 04:28:58 AM »
I've setup confirmation for a command but it doesn't work despite following the guide. Please look at the screenshot below

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Command confirmation not working
« Reply #1 on: July 05, 2019, 04:35:48 AM »
You need to do a compare for each phrase individually.

Conditions don't do anything with semicolons, so you're checking whether, for example, "affirmative" equals "confirm; yes; affirmative; Restart".


You can right-click the begin condition action ("Begin Text Compare") and choose "Edit With Condition Builder" to start adding the individual phrases as "Or" sets.

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #2 on: July 05, 2019, 04:49:50 AM »
damnit!

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #3 on: July 05, 2019, 04:53:30 AM »
Do the variable name / token need to be unique for each command?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Command confirmation not working
« Reply #4 on: July 05, 2019, 04:54:18 AM »
Actually, looking at your command again, you can also do a compare against "@@invalid", which will be the value of "Restart" in your command if anything but the phrases you've defined is spoken.

If you also have "Timeout" set to anything but 0, you'll want to check against "Not set" as well, as that will be the value of "Restart" if nothing is said before the timeout.


Do the variable name / token need to be unique for each command?
Not necessarily. Variables are global by default, so if you check the value in one command after setting it in another, the value will still be there, so that's something to watch out for.

The clean way to reuse variables that only need to exist for a given command is to use the "~" prefix, which will result in the variable being scoped to only that command, and to a specific running instance (I.E. if you use a variable with that prefix, running the same command multiple times simultaneously allows each instance of that command to have a different value assigned to that variable name).


More information on variable scope can be found in VoiceAttackHelp.pdf, under "Advanced Variable Control (Scope)".

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #5 on: July 05, 2019, 04:59:01 AM »
That might be too much for me to get my head around this time of night!
This software is insanely powerful, it keeps sucking me in deeper with all the possibilities!

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #6 on: July 05, 2019, 05:14:22 AM »
I've changed the text compare to a single word and it still isn't working it just throws up the command edit window.

I have no idea what this means: compare against "@@invalid", which will be the value of "Restart" in your command if anything but the phrases you've defined is spoken - where do I find / enter that?

EDIT: I've also changed "Wait for spoken response" to 'confirm' only.

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #7 on: July 05, 2019, 05:19:41 AM »
I fixed it!
Hadn't noticed that the Token file was different!
All working now, thank you so much.
(I'll go away and read the manual)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Command confirmation not working
« Reply #8 on: July 05, 2019, 05:34:31 AM »
Not sure what you mean by "Token file".


You can check whether "Restart" has a value of "@@invalid", to determine whether what was spoken was not one of your predefined responses (and whether the variable has been set, to check for the timeout):
Code: [Select]
Say, 'Confirm Restart Computer'
Wait for spoken response: 'confirm; yes; affirmative; Restart'
Begin Condition : [Restart] Does Not Equal '@@invalid' OR [Restart] Has Not Been Set
    Restart PC
End Condition


As an aside, to define multiple phrases you can use dynamic command sections, rather than defining every permutation explicitly.
E.G.
[Restart;Restarts] [PC;Computer];[PC;Computer] [Restart;Restarts]

Bazmack

  • Newbie
  • *
  • Posts: 21
Re: Command confirmation not working
« Reply #9 on: July 05, 2019, 05:39:39 AM »
That's very useful! I'll give it a go