Entering Program Code


Entering Program Code

The editor for CindyScript code can be opened by selecting the menu item Scripting/Edit Scripts. When this item is selected, a window for the program code editor is opened. Each construction has an individual program editor window. When first opened, the editor window looks as follows:

The script editor

This window contains several components that require explanation. The main part of the window is occupied by a large white space (the middle part of the right side). This is the text field in which you will enter your script later on. The left side of the window is occupied by a "tree view," in which you can select an occasion upon which a script should be executed. The first step in entering a script consists in choosing a suitable occasion.

The lower part of the right side is reserved for console output, while the top part of the window contains some controls and a field in which you can enter a name for your script.

Entering a Small Script

The first step in entering a script consists in choosing the occasion on which the script is to be executed. For this, one has to click on one of the "Events" shown on the left. Let us choose the "Draw" event. A script entered in the Draw event will always be executed when drawing is performed on the screen. After this entry has been selected, the main part of the window is ready for input. Clicking in the main window allows one to enter script code. In the example shown below a small script was entered and given the title "My first script"

Entering text

Pressing the button with the two gears executes the script. In the above example a green dotted line will be drawn consisting of ten simple dots. Alternatively the execution can be started by pressing <shift>+<enter>.

Execution Slots

Every script in Cinderella is associated with an occasion on which it will be executed. Since scripts in Cinderella are assumed to run during the runtime of the program, it may well happen that the same script is executed many times during a move. The precise interpretation of the different occasions is described below:

  • Draw: A script in this slot is executed right before a new screen picture is generated. Scripts entered here will be executed very often. This is the typical place to enter a script that should be automatically updated when the user drags geometric elements.

  • Move: Scripts in this slot will be executed even more often than those in the "Draw" slot. They are always invoked if the position of free elements has changed. In general, this happens more often than just at screen refresh. Sometimes putting a script in the "Draw" slot produces strange and unexpected results. It might then be a good idea to place it in the "Move" slot.

  • Initialization: A script in this slot is executed whenever the parse button of the script editor is pressed. This slot is very useful for resetting variables or points to an initial state or position.

  • Timer Tick: A script in this slot causes an animation controller to be shown in geometric view (if not already present). When the play button of the animation controller is pressed, a script in this slot will be regularly executed every few milliseconds.

  • Integration Tick: This event is only relevant in context with physics simulations. If a script is contained in this slot it will be executed whenever the internal physics simulation engine requires information on the position and forces of masses. This slot is needed when one wants to implement user specific force potentials.

  • Simulation Start: This script is executed when the animation controller changes from "Stop" to "Play." It is a very good place to enter initial setups for animations.

  • Simulation Stop: This script is executed when the animation controller changes from "Play" to "Stop." It is a very good place to evaluate the result of an animation.

  • Mouse Down: This slot and the following three slots are very useful for programming user interfaces in CindyScript. A script in this slot is executed whenever the mouse button is pressed. With the function mouse() the current mouse coordinates can be read within a script.

  • Mouse Up: Scripts in this slot are executed when the mouse is released.

  • Mouse Click: Scripts in this slot are executed when the mouse is moved.

  • Mouse Drag: Scripts in this slot are executed when the mouse is dragged.

  • Key Typed: Scripts in this slot are executed when the key on the keyboard is typed. This slot is very useful for handling user input via the keyboard. A string that corresponds to the currently pressed key can be accessed via the key() and via the keydownlist() functions.

  • Key Down: Scripts in this slot are executed when the key on the keyboard is pressed, exactly at the moment when the key moves down.

  • Key Up: Scripts in this slot will be executed when the key on the keyboard is released, exactly at the moment when the key moves up.

Control Buttons

In the upper part of the script editor window are two buttons to start and stop the program, as well as a text field to provide names to parts of the program and a language chooser for switching between different languages (at present, only CindyScript is documented).

The script controls

Perhaps the most important part of these controls is the "Play" button (the one with the two gears). Whenever this button is pressed all scripts are parsed and the execution of the program is started. Every change in a program requires the play button to be pressed to become active. Alternatively, the key combination <shift>+<enter> can be used as an equivalent for pressing the play button.

It may happen that a script gets stuck in an infinite loop or performs a calculation that simply takes too long. As a kind of emergency exit, the "Stop" button can be pressed.

The little text field on the left can be used to give a script an individual name. Scripts with different names can be accessed and edited separately.

Finally, there is a drop-down menu for choosing the language for the script. In this documentation you will find all necessary information for programming in CindyScript. However, it is also possible to program in "Python", "JRuby" or in the core Cinderella geometry language. These options will be documented later and elsewhere.

You find more information about the ways to enter code in the corresponding section of the reference manual.

Contributors to this page: Kortenkamp , Kohler , Richter and Lembach .
Page last modified on Friday 02 of September, 2011 [17:32:43 UTC] by Kortenkamp.

The content on this page is licensed under the terms of the License.

free viagra samplehentai girlsmature pussymilfseeker cialis samplescam clip movie nude webcammother incest order viagra online cialis ukanime rapeparis hilton phone numbers viagra alternatives cialis forum cialis free samplehot girls in pantiesmonster of cocks discount cialis cilias free viagra samplesfree chat rooms cilia structurefree cartoon sex comics buy cialis order viagrafree adult videosplump girl gallerypantyhose gallerycum on her face cheapest cialisbisexual moviestampa bukakehuge black cock thumbnails buy cialis onlineporn star cialis drugwomen having sex cheap generic viagra alternative to viagra natural viagra cheap viagraoral sexteen webcam strip videosnude spanish girlserotic sex cams movies viagra side effectscartoon adultdisney sex animenude blonde hairygang bang swinger cialis viagrabisexual free moviesgay twinkswebcam chat live xxxyoung teens order cialislatina girls thongscum loversjapanese girl viagra cheapyoung japanese girlsmr chews asian beavergangbang squadshoshone indiansmature wiveslive webcam chat girlsfree ebony viagra on lineasian ladyboysteen boys viagra pillsself bondage techniques cailisincest familyfree ebony cheap cialisgay amateur cialis genericbusty asian viagra onlinemature breasts viagra for women free viagrabig boobies cialis generic viagragloryhole gaylatinas in thongs female viagraindian tits viagra 6 free samplesamateur upskirt viagra alternativefree xxx video cialis online discountgalleries of teen girls cialis dosage cheap generic cialisparis hilton pornopussy cat dollsbrutal sexgay peopleblack milfsno tits discount viagrablonde hairy pussyshemale animefree hardcore moviesmom strips for sonfat titscelebrity legsdouble anal levitra vs cialis cialis tadalafil cialis cheapgay bdsmcelebrities exposed viagra generic alternatives to viagra viagra canadabestialitypink porn stars viagra jokesclips of teen sexchicks suck horse cock online viagrasex with horsespainful analglory holes floridafree american bukkake cialis online buy viagrabig cock cum free cialisteen gay porn cialis side effects herbal viagra best price viagra purchase cialis cialis soft tabs cialis vs viagrafree fat girl webcamfree porn movie clipsoral penis suckingebony hardcore viagra pricepantyhose crossed legs cialis and levitralesbiennesblonde boobs buy viagra online