Control Command In A Variable

 
#1

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?

#2

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 ControlCommand(), like this:

Code:


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



Alan

#3

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"Winky

Saywait("who are you?"Winky

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


SayEZBwait("I am EZB "Winky

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.

#4

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

#5

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

#6

Ricahrd,

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

Does EZ Script ignore spaces?

#7

@Dave... yes
Spacing can be good for readability....

#8

@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