Step 7. Combining speech and movement.
So far, the examples provided have the EZ-B speaking and the carry out actions after it has stopped talking. But there may be times where you may want your robot to talk at the same time as it performs an action.
This is easy to do using a ControlCommand() like mentioned in level 2, but with a slight difference. Instead of typing in the robots speech response followed by a [ContolCommand] in an AIML category, we only use the [ControlCommand] script, and put the robots spoken response in to an EZ Builder script using the Say() or SayEZB() script commands, and make a new or edited ControlCommand().
The video below shows two examples using this method. The first half shows using a Pandorabot response followed by a script command which doesn't do what we want. The second half shows using only a ControlCommand() using the Say("") script command which executes the way we want it to.
Here is how it is done...
1.) Like in the previous step, what we do is add an EZ-Script control to an EZ Builder project. Then we will enter the following script...
Say("I am now moving a servo, while I speak at the same time.")
We will name this new script "Speech Servo Test" and save the settings.
2.) Now reopen the script editor, and under the last line of script, right click the mouse button to bring up the Cheat Sheet commands. Find the "ControlCommand("Speech servo test", ScriptStart), click on it to add it to the script, highlight just the ControlCommand() and cut it using CTRL and X, or right mouse click. Re-save the project.
3.) Now make a new AIML category in your Pandorabot AIML editor and write a new category pasting the ControlCommand() in the bots template. It should look like the following...
AIML category with speech EZ-Script example.
Save this AIML category and republish your Pandorabot. Have you noticed the difference between the AIML example above, and previous examples? There is no actual phrase for the bot to say in between the Template tags, only the ControlCommand(). This is covered by using the Say("") command in the EZ-Script.
4.) Once published, test the script in EZ Builder. Say "Move your servo.", EZ Builder will run the ControlCommand() and tell the EZ-B to move the servo while saying "I am now moving a servo, while I speak at the same time.".