next up previous
Next: Identifying cast members and Up: Multimedia Programming:Scripting (Lingo) Previous: Optional keywords and abbreviated

Literal Values

A literal value is any part of a statement or expression that is to be used exactly as it is, rather than as a variable or a Lingo element.

Literal values that you encounter in Lingo are character strings, integers, decimal numbers, cast member names, cast member numbers, symbols, and constants.

Note: The value function can convert a string into a numerical value. The string function can convert a numerical value into a string.

Each type of literal value has its own rules.

Strings are characters that Lingo treats as characters instead of as variables. Strings must be enclosed in double quotation marks. For example, in the statement

member ("Greeting").text = "Hello"

``Hello'' and ``Greeting'' are both strings. ``Hello'' is the actual string being put into a text cast member; ``Greeting'' is the actual name of the cast member.

Similarly, if you test a string, double quotation marks must surround each string, as in the following example:

if "Hello Mr. Jones" contains "Hello" then soundHandler

Lingo treats spaces at the beginning or end of a string as a literal part of the string. The following expression includes a space after the word to:

put "My thoughts amount to "

Director works with integers between -2,147,483,648 and +2,147,483,647. (For numbers outside of this range, use floating-point numbers.) Enter integers without using commas. Use a minus (-) sign for negative numbers. You can convert a decimal number to an integer by using the integer() function. For example, the statement

set theNumber = integer(3.9)

rounds off the decimal number 3.9 and converts it to the integer 4.

Some Lingo commands and functions require integers for their parameters. See the entry for the specific Lingo element for more information.

A decimal number, is what Lingo refers to as a floating-point number. The floatPrecision property controls the number of decimal places used to display these numbers. (However, Director always uses the complete number in calculations.) See the floatPrecision for information about setting the number of decimal places used for decimal numbers. You can also use exponential notation with decimal numbers: for example, -1.1234e-100 or 123.4e+9. You can convert an integer or string to a decimal number by using the float() function. For example, the statement

set theNumber = float(3)

stores the value 3.0 in the variable.


next up previous
Next: Identifying cast members and Up: Multimedia Programming:Scripting (Lingo) Previous: Optional keywords and abbreviated
Dave Marshall
10/4/2001