All Tutorials / Steve G / Pandorabot tutorial

Pandorabot tutorial

Step 6. Using multi line scripts.

As previously mentioned, using multiple script commands in a single Pandorabot response is not possible. Or is it?

In Fact there is a way to run multiple lines of script or multiple controls quite easily using "Control Commands" or "Cheat Sheet" commands as they are now called. If you're new to EZ Builder, or have had your EZ-B for a while and haven't yet fully explored its full potential and not sure what Cheat Sheet ControlCommand()s are, these are ways of easily accessing existing scripts, controls, or other functions such as "Soundboards" and "Auto Positions", and puts them in to a single line of script. Basically, a Cheat Sheet is a short cut. This makes programming a robot to execute extensive or simultaneous actions very easy to do, and for this example, that's what we want for the Pandorabot control.

In this example, the servo will move to two positions with a three second sleep in between servo movements.

1.) What we do is add an EZ-Script control to an EZ Builder project. Then we will enter the following script...


#EZ-Script example.


We will name this new script "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("servo test", ScriptStart). Now 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 multiline EZ-Script example.

User-inserted image

Save this AIML category, and republish your Pandorabot.

4.) Once published, test the script in EZ Builder. Say "Move your servo." and the bot should respond with "I will move my servo to the left, then to the right.", then EZ Builder will run the ControlCommand() and tell the EZ-B to move the servo, as seen in the next video.

So far, the bot responds and then runs a script. The next step will show you how to have the bot speak while moving a servo at the same time.