loading
 
Use voice commands to control roborealm
Anonymous
14 year
I am trying to use voice commands to control RoboRealm with the API program. For example, if the user of my project says "Turn Off" I want roborealm to close. I know that I can close Roborealm by using rr.close(), but I cannot get the voice commands.

I have created variables with the Listen module and I am trying to use the getVariable function to get those variables for the voice commands. How do I go about using the variables in an if statement?

For example if I use getVariable("turn off"), then how do I declare it to be able to say IF turnoff = "Turn off".  How do I check to see that the user actually said "turn off"?
Anonymous 14 year
The variable you specify in the listen module will always be the same regardless of the phrase that is detected. So, if you specify "my_phrase" in the Listen module as the variable (seen in the docs as spoken_text) then anything the module detects will be the value of that variable. So in your case you would use

myStr = rr.getVariable("my_phrase")

and then test myStr for

if myStr = "Turn off" then etc.

Note that the phrase spoken is NOT a variable but in fact the value of a variable that always remains the same.

Note that the above syntax is not for a specific language as you did not indicate what language you are using.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index