All Tutorials / Steve G / Setting Servo speeds and Initialization Script Tutorial

Setting Servo speeds and Initialization Script Tutorial

Step 5. Another Init script example.

In this example, we use another variable to set EZ-Builder to tell you the current date using your computers clock.

1.) As before, in either a "Connection" script in the "Connection Control" script editor, or in a connection script in a script manager, enter the following "Init" script and save it...

Code:

$SayDate = 0
$lastDay = $day



2.) From the EZ Builder menu ribbon, either add an EZ-Script control by clicking on "Project" then "Add Controls", "Scripting", then "EZ-Script" and click on the gear icon to open the script editor.

2A.) or click on "Project" then "Add Controls", "Scripting", then "EZ-Script Manager". On the script manager, click on "Add Script" and click on "Edit" to open the script editor.

3.) Copy the following script in to the script editor then hit Save when you're done...

Code:

# Script courtesy of Rich Pyke.

if ($lastDay != $day)
goto(sayDay)
endif
if ($SayDate = 1)
goto(toldYou)
endif

# Say day, date, month
:sayDay
SayWait("Today is " + $dayName + " , the " + $day + " of, " + $monthName )
$lastDay = $day
$SayDate = 1
halt()

# Repeat day, date, month
:toldYou
SayWait("Haven't I already told you, it is " + $dayName + " , the " + $day + " of, " + $monthName )
$SayDate = 0
halt()



4.) Power on your EZ-B and connect it to your EZ Builder project. When the connection is made, the "Init" script will automatically run and set the vairabe. When You press "Start" on your date script, you computer will tell you the current date. Pressing "Start" again, you computer will tell you that you already asked for the date, and tell you it again.