Step 3. Soundboard Scripts.
So with our "Soundboard (PC)" or "(V4)" control added which now includes an audio file, we will now go through how to play this file with a script.
1.) From the EZ-Builder menu ribbon, click "Project", "Add Controls", "Scripting", and "EZ-Script". Once the script control has been added, click on the "Script Config" tab to open the script editor.
2.) Right click on the script editor text input field to bring up the "Cheat Sheet" commands for your project (or click the "Cheat Sheet" tab on the top right of the editor). Look down the list and hover over the soundboard option. This will expand the window and display the ControlCommand()s for the soundboard (mentioned in step 1). For this example, click on the ControlCommand("Soundboard", Track_0) command to add it to the script.
3.)On a new line, write the following script command...
Print("Wake up lazy bones.")
then click "Save".
4.) Now click "Start" on the script control. The sound file will now play, and the "Print" message will show up in the debug window...
Here is another simple example you can use. This will act as an alarm clock so when 7:30am is reached, the robot will say something, then play the audio file when it finishes speaking.
SayWait("Hey you. Get out of bed. It is time to get up.")
ControlCommand("Soundboard Test", Track_0)
Press "Start" on the script and let it run. When the time is reached, the script will trigger. If you have multiple audio tracks, you can use the command to play a random choice of audio file...
ControlCommand("Soundboard Test", Track_Random)
And adding the following script will stop the audio file from playing...
ControlCommand("Soundboard Test", Stop)
The next step will explain using scripts within the "Soundboard (EZB) control.