The CindyScript Editor


To enter CindyScript can use the editor that is available from the menu File/Edit Scripts. Here we explain briefly how you use the editor.

The Input Window




The script editor shows a three pane view. On the left you see a an overview over all occasions (see below) and the associated scripts. On the right you see, below a panel that features a start, stop and help button as well as a field to enter script names, a large text area which is used to edit (i.e. type) scripts, and a smaller text area that shows any output from the scripts.

Occasions


Cinderella is highly interactive, and that is the reason for many "occasions" that are suitable for CindyScript commands. On the left side of the script editor you see the available occasions.

Usually, you write scripts for the "Draw" occasion. Scripts there are executed whenever the view is rendered. To edit a script, first click on "Draw".



The edit area will change to "Enter your script here". Click there, and start entering text.



In the view you will notice a diagonal of green points that were created by the script.



The occasions are described in this table:

OccasionExecution TimeRemarks
Draw Every time a view is rendered
Move Every time an element is moved Not every movement will trigger a rendering of the view, which means that Move occasions occur more often than Draw occassions.
Initialization Once before any other script is executed This script will only be executed when a script has changed or construction elements were added or removed.
Timer Tick Periodically
Integration Tick Periodically
Simulation Start On start of a simulation in CindyLab
Simulation Stop On stop of a simulation in CindyLab
Mouse Down Mouse button was pressed
Mouse Up Mouse button was released
Mouse Click Mouse button was used to click
Mouse Drag Mouse was moved with mouse button pressed
Key Typed A key was typed



The Shell


You can also enter CindyScript commands and have them executed immediately. Just choose the "Shell" item from the left panel, and type the commands into the text area on the right. Pressing shift+enter will execute the command you typed, and you will see the in- and output in the lower text area. You can use shift-up and shift-down to scroll through a history of commands entered.



Other Languages


You can choose the programming language used to interpret a script using the choice box in the top panel. Available languages are Python and CDY, the internal language that is used to store constructions. However, currently we only support CindyScript.






Page last modified on Monday 29 of May, 2006 [13:39:19 UTC].
The original document is available at http://doc.cinderella.de/tiki-index.php?page=The%20CindyScript%20Editor