Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Canada
Asked — Edited

Control Command In A Variable

Is it possible to insert a "control command" in a $variable?

ex: $Female= ControlCommand("Speech Settings", SetVoiceGender, "Female")

for now the result faults with "Missing String Quotes or Invalid Expression:"

any idea?


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
#1  
I am not sure how you would execute it, but you would need to put the whole ControlCommand string in quotes for the variable to accept it.

I would instead make a $gender variable and use it in the control command, like this:

Code:


$gender = "Female"
ControlCommamd("Speech Settings",SetVoiceGender,$gender)


Alan
Canada
#2  
Tanks Alan,

The variable within the ControlCommand() is working.

I am looking to simplified the use of ControlCommand() to switch gender in a script where I establish a dialog between my PC and EZB

here's an example:

ControlCommand("Speech Settings", SetVoiceGender, "Female")

Saywait("who are you?")

ControlCommand("Speech Settings", SetVoiceGender, "Male")


SayEZBwait("I am EZB ")

I am wondering if it's be possible to switch gender within the "Say" command.

By the way it's fun and plenty of possibility to listen both unit chanting together.
#3  
I would do something like this, although could get even more elegant by having the phrases in text files and doing "FileReadLine" commands so the script is just a few subroutines.

note: untested --

Code:


goto(female)
saywait("who are you")
goto(male)
SayEZBWait("I am EZ-B")
goto(female)
saywait("What is your favorite color?")
goto(male)
SayEZBWait("Blue")
goto(end)
:male
ControlCommamd("Speech Settings",SetVoiceGender,"Male")
return
:female
ControlCommamd("Speech Settings",SetVoiceGender,"Female")
return
:end
#4  
As far as I know ControlCommand does not return a value (in this case anyway) so you can't assign it to a variable...

You'll have to do something like below...

Code:


saywait("am I male or female")

$g=WaitForSpeech( 30, "male",female") #script will wait 30 seconds for your answer

if($g="female")
ControlCommand("Speech Settings", SetVoiceGender, "Female")
$gender="female"
#do something here
else
ControlCommand("Speech Settings", SetVoiceGender, "Male")
$gender="male"
#do something else here
endif
#5  
Ricahrd,

Will your script work with that space inside the parentheses after the $g=WaitForSpeech( ?

Does EZ Script ignore spaces?
#6  
@Dave... yes
Spacing can be good for readability....
Canada
#7  
@Alan
Your code example is working fine and will simplify my script.
Text file usage is also a great idea.

@ Richard
Tanks for your suggestion

gilles