User Guide

Chapter 16426
Troubleshooting Lingo
Scripts dont always do what you want the first time. The script often has an error in its syntax:
possibly a word is misspelled or a small part of the script is missing. Other times the script might
work but doesnt produce the expected result.
Mistakes or bugs almost always occur when writing Lingo, so you should allow enough time for
debugging when you develop multimedia titles.
As your skill with Lingo increases, you’ll probably encounter different types of problems as you
master one area but start learning others. However, the basic troubleshooting techniques
described in this section are useful for novice and advanced users alike.
The best way to correct a Lingo bug varies from situation to situation. There arent one or two
standard procedures that resolve the problem. You need to use a variety of tools and techniques,
such as the following:
An overview and understanding of how scripts in the movie interact with each other
Familiarity and practice with common debugging methods
The following tools help you identify problems in Lingo:
The Message window, when tracing is on, displays a record of the frames that play and the
handlers that run in the movie.
The Debugger window displays the Lingo that is currently running, the sequence of
handlers that Lingo ran to get to its current point, and the value of variables and expressions
that you select.
The Script window lets you enter comments, insert stopping points in the script, and select
variables whose value is displayed in the Object inspector.
The Object inspector lets you view and set the values of objects and properties you select.
Good scripting habits
Good scripting habits can help you avoid many Lingo problems in the first place.
Try to write Lingo in small sets of statements and test each one as you write it. This isolates
potential problems where they are easier to identify.
Insert comments that explain what the Lingo statements are intended to do and what the
values in the script are for. This makes it easier to understand the script if you return to it later
or if someone else works on it. For example, the comments in these Lingo statements make the
purpose of this
if…then statement and repeat loop clear:
if the soundLevel = 0 then
-- Loop for 4 seconds (240 ticks)
startTimer
repeat while the timer < 240
end repeat
end if
Make sure that Lingo syntax is correct. Use the Script windows Lingo menu to insert
preformatted versions of Lingo elements. Rely on the Lingo Dictionary to check that statements
are set up correctly.
Use variable names that indicate the variables’ purpose. For example, a variable that contains a
number should be called something like
newNumber instead of ABC.