to Lingo notes 1
to Lingo notes 2
Lingo notes 3
Lingo supports a variety of data types, including references to sprites and cast members, TRUE and FALSE (Boolean) values, strings, constants, integers, floating-point numbers, points, rects, colors, and dates.
The following are general syntax rules that apply to all Lingo. Most Lingo terms also have their own individual requirements about terms that they must be combined with. For the rules for a specific Lingo term, see the termÕs syntax in the Lingo Dictionary.
Functions that return values require parentheses. When you define functions in handlers, you need to include parentheses in the calling statement.
Use parentheses after the keyword sprite or member to refer to the objectÕs identifier: for example, member("Patrice Lumumba") refers to the member named Patrice Lumumba.
You can also use parentheses to override LingoÕs order of precedence in math operations or to make your Lingo statements easier to read.
For example, this math expression will yield a result of 13:
5 * 3 - 2
while this expression will yield a result of 5:
5 * (3 - 2)
Words within expressions and statements are separated by spaces. Lingo ignores extra spaces.
In strings of characters surrounded by quotation marks, spaces are treated as characters. If you want spaces in a string, you must insert them explicitly.
You can see Lingo that uses strings in Writing strings.
Lingo is not case sensitiveÑyou can use uppercase and lowercase letters however you want. For example, the following statements are equivalent:
Set the hiLite of member "cat" to True
set the hilite of member "Cat" to True
SET THE HILITE OF MEMBER "CAT" TO TRUE
Set The Hilite Of Member "Cat" To True
However, itÕs a good habit to follow script writing conventions, such as the ones that are used in this book, to make it is easier to identify names of handlers, variables, and cast members when reading Lingo code.
Also, note that literal strings are case sensitive. See Writing strings.
Comments in scripts are preceded by double hyphens (--). You can place a comment on its own line or after any statement. Lingo ignores any text following the double hyphen on the same line. For more information about comments in Lingo, see Troubleshooting Lingo in the Director Support Center.
Comments can consist of anything you want, such as notes about a particular script or handler or notes about a statement whose purpose might not be obvious. Comments make it easier for you or someone else to understand a procedure after youÕve been away from it for a while.
Double hyphens can also be used to make Lingo ignore sections of code you want to deactivate for testing or debugging purposes. By adding double hyphens rather than removing the code, you can temporarily turn it into comments. Select the code you want to turn on or off and then use the Comment or Uncomment buttons in the Script window to add or remove double hyphens easily.
You can abbreviate some Lingo statements. Abbreviated versions of a command are easier to enter but may be less readable than the longer versions. The go command is a good example. All the following statements are equivalent, but the last one uses the fewest keystrokes.
go to frame "This Marker"
go to "This Marker"
go "This Marker"
It is good practice to use the same abbreviations throughout a movie so your Lingo is easier to read.
A script often needs to determine whether a certain condition exists before carrying out a set of instructions. For example, a script may need to check whether a network operation is finished before doing something that requires the operationÕs result.
The term TRUE or the number 1 indicates that the condition youÕre testing for exists.
The term FALSE or the number 0 indicates that a condition doesnÕt exist.