Scripting




Introduction

A nice feature of the Doctor Aquarium program is the ability to write advanced control logic in a scripting language. When a new task is added, using the Task wizard a script is automatically generated based on the triggers, and actions selected by the user. The resulting script, while sufficient for most tasks, still may need to be modified to express more complicated logic. The scripting Language supplied with the program allows such modfication with ease.


Orgins of the scripting Language

The scripting language used by Doctor Aquarium is a powerful subset of Delphi programming language, called DWS (Delphi Web Script). The scripting language is an object oriented version of the Pascal language.


Tutorial
The syntax of the scripting language used by Doctor Aquarium is very close to standard pascal, and can be most easily learn from a tutorial. An excellent tutorial on the pascal language can be found here

Taoyue Pascal Tutorial


Editor

The Doctor Aquarium application comes with a powerful built in editor. The editor features syntax highlighting, and code completion. The editor is accesible on the last page, of the the task wizard. You can bring up the task wizzard by creating a new task (from the main menu) or by double clicking on an already defined task. The task wizard will automatically generate a script based on the selected triggers, and actions. To customize a task script, you need select the 'I will write the script' radio button, and then edit the script. At any time you can click the button to check for syntax errors, and if your script complies correctly you can choose to execute (run) the script.















Plugins & Getting Help

Each plugin that supports a script interface, will have a class named after it. The class name, and the plugin name will be exactly the same, with the exception of the Task plugin. The task plugin contains a class that is named 'ThisTask' instead. The reason for this is that the task plugin calls internal methods, that always reffer to the current task. The code completion feature used in the editor is the easy way to see which methods a given plugin implements. Anywhere in the editor you write a Plugin Name followed by a dot, for example 'SunMoon.' the editor will show a drop down list of all the SunMoon Methods. Each method of class is documented in the plugins info.html file. The plugins info.html file can be brought up by selecting the plugin, and (i) info icon in the application or by selecting the plugin in the [Scripting] section of this help file.

Built in Functions