What is Lingo?
Lingo is Director's programming, or scripting, language. It is mature and powerful and an essential part of creating in-depth interactivity.
Types of Lingo scripts
Lingo scripts can exist in many locations throughout Director ...
Sprite scripts (Behaviours) are attached to sprites or groups of sprites in the score.
Cast member scripts are attached to individual cast members
Frame scripts (Behaviours) are attached to cells in the scores Scripting/Behaviours channel
Movie scripts are not attached to anything they are simply written and appear in the cast
In Lingo scripts are called Objects. When an event occurs a message is sent through these objects in a specific order ...
Scripts attached to the sprite in question eg the button that was clicked.
Cast member of the sprite in question.
Scripts attached to the current frame.
Start with "on" and end with "end". There are 2 types:
Event handlers - eg "on mouseUp"
Custom handlers - eg "on fred". These handlers are triggered by "calls" rather than events.
A Command is an instruction.
A Function gives a result.
eg The "clickOn" function returns the value (or number) of the sprite which has been clicked on.
eg The "date" is a function which returns the current date.
A Property is a specific value attached to an item. Properties can be changed interactively or over time. Property names are always preceded by "the"
eg the stagecolor
eg the locH (horizontal location)
Operators are mathematical expressions.
Keywords complete the syntax of a script.
A variable is a "container" (bit of RAM) that may contain either -
Strings (text). Any set of characters enclosed in quotations (") is considered a string.
Booleans (eg true or false, on or of)
Integers (whole numbers)
There are 4 types of variables:
Local variables A local variables only exist inside the handler that initialised it (by naming therefore creating them). Local variables cannot be "interrogated" by other variables.
Global variables A global variable may be interrogated at any time by any handler.
Arrays (called Lists in Lingo) There are 2 types of lists. 1) Property lists. 2) Lists
Constant A variable that once initialised with a value doesn't change, such as - the best score in a game or a players name.
Control statements always start with "if". For example ...
if the member of sprite the CurrentSpriteNum = "Button up" then
set the member of sprite the currectSpriteNum = "Button down"
Repeat loops start with "repeat" and finish with "end". The statements between them will repeat until a condition is met. There are several types of Repeat Loop such as "repeat while" and "repeat with". The following is a script example:
repeat while the timer < 200
Ai addition to standard "display" text fields, Lingo uses "live" field text elements which allow user entry and can be used to display results of calculations or other processes.
MIAWs (Movies In A Window)
A MIAW is an object in RAM. It's a movie launched into its own window by another movie which is already running in RAM. Click here for more.