Author Topic: Condition Questions  (Read 3885 times)

DetlefP

  • Guest
Condition Questions
« on: April 29, 2017, 12:38:37 PM »
First, I'm a beginner with VA. So please forgive my Noobness and my English...
there might be a post already with this Topic but right now i wouldnt know what to search for. if yes, please excuse me.

I would like to make a few Commandos for a Game.
For Example:
i say "Exit game" and VA asks me "Really Exit the Game?" and i must say yes or no. if yes, continue and Exit, if no, exit the command line and Continue the Game. is it possible to realize that? Its like a Condition with a voice command inside.

And my second Question is:

is it possible somehow to let VA sorta notice the keys i pressed?
For example:
In game i pressed the Missile, lets say "1", and VA says Fox One

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Condition Questions
« Reply #1 on: April 29, 2017, 01:44:38 PM »
i say "Exit game" and VA asks me "Really Exit the Game?" and i must say yes or no. if yes, continue and Exit, if no, exit the command line and Continue the Game. is it possible to realize that? Its like a Condition with a voice command inside.
If you want it in a single command, you'll have to use dictation:
Exit game
Code: [Select]
Set Boolean [DictationComplete] to False
Start Loop While : [DictationComplete] Equals False
    Start Dictation Mode (Clearing Dictation Buffer)
    Start Loop While : [{DICTATION}] Equals ''
    End Loop
    Stop Dictation Mode
    Begin Text Compare : [{DICTATION}] Contains 'Yes'
        Say, 'Exiting game'
        Set Boolean [DictationComplete] to True
    Else If Text Compare : [{DICTATION}] Contains 'No'
        Say, 'Continuing game'
        Set Boolean [DictationComplete] to True
    Else
        Say, 'Please say "Yes" or "No"'
    End Condition
End Loop

Otherwise you need two commands:
Exit game
Code: [Select]
Set Boolean [Confirmation] to [Not Set]
Start Loop While : [Confirmation] Has Not Been Set
End Loop
Begin Boolean Compare : [Confirmation] Equals True
    Say, 'Exiting game'
Else
    Say, 'Continuing game'
End Condition

[Yes;No]
Code: [Select]
Begin Text Compare : [{CMD}] Equals 'Yes'
    Set Boolean [Confirmation] to True
Else
    Set Boolean [Confirmation] to False
End Condition
I'm "abusing" VoiceAttack's tri-state boolean here, but it works well for this type of thing.


Regardless of which solution you use, the built-in Microsoft Speech Recognition engine may have trouble recognizing "Yes" and "No", so you could try "Affirmative" and "Negative" instead.

is it possible somehow to let VA sorta notice the keys i pressed?
For example:
In game i pressed the Missile, lets say "1", and VA says Fox One
If you're using a keyboard key, mouse button, or joystick button to trigger that event, you can use the corresponding "When I press" option(at the top of the "Add/Edit a Command" window) to make the command run when you press the key/button, and execute a  "Play a Sound" action, for example.

DetlefP

  • Guest
Re: Condition Questions
« Reply #2 on: April 29, 2017, 01:57:41 PM »
That makes sense. Thank you for the quick help. The keypress Option i found myself in the meantime

DetlefP

  • Guest
Re: Condition Questions
« Reply #3 on: April 29, 2017, 02:55:42 PM »
Feeling kinda Dumb. I cant get that Code to work. It stays in the Loop No matter what i say, and keeps saying please "Yes" or "No"...well in German of course. If i say yes a second loop starts in the background, but the given Answers will not be said. I'd like to insert my Code here but don't know how.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Condition Questions
« Reply #4 on: April 29, 2017, 03:49:22 PM »
Right click the action list and click "Copy All as Text" in the context menu, when posting your reply click the # icon to add code tags, and paste in between them.

DetlefP

  • Guest
Re: Condition Questions
« Reply #5 on: April 29, 2017, 03:54:11 PM »
Ok, here'y my Code
Code: [Select]
Set Boolean [DictationComplete] to False
Start Loop While : [DictationComplete] Equals False
    Start Dictation Mode (Clearing Dictation Buffer)
    Start Loop While : [{Dictation}] Equals ''
    End Loop
    Stop Dictation Mode
    Begin Text Compare : [{Dictation}] Contains 'Ende'
        Say, 'Beende'  (and wait until it completes)
        Set Boolean [DictationComplete] to True
    Else If Text Compare : [{Dictation}] Contains 'Abbruch'
        Say, 'Weiter machen'  (and wait until it completes)
        Set Boolean [DictationComplete] to True
    Else
        Say, 'Bitte "Abbruch" oder "Ende" sagen'  (and wait until it completes)
    End Condition
End Loop

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Condition Questions
« Reply #6 on: April 29, 2017, 04:17:23 PM »
Tokens are case sensitive; "{Dictation}" is not a valid token, "{DICTATION}" is.

DetlefP

  • Guest
Re: Condition Questions
« Reply #7 on: April 29, 2017, 04:23:14 PM »
Now i see it too...All i can say is Duuuh...