Dean's Director FAQ - LINGO
Another FAQ exists at
MediaMacros, which
is new and extensive.
Lingo
Question: Why don't my scripts work?
Answer
The most common bugs in an interactive multimedia project occur
in scripts. A script may give an error message or it may work but will not
produce the result you expect. Bugs can be introduced while typing a script,
rearranging contents of the Score or moving around external files.
Scripts may work for a number of reasons and may vary from situation to
situation. Below are the most common source of bugs/errors in Lingo scripts:
Typos in Lingo Script
Syntax errors and misspelled Lingo terms are the most common bugs created
when writing scripts. When a script does not work or gives error messages,
the first thing you should check is that you have not mistyped a word or
have the incorrect syntax for a command or statement. These typing errors
include terms spelt incorrectly, spaces in wrong places or missing punctuation,
keywords, commands or other essential Lingo elements.
Changing scripts unintentionally
An advantage of a sprite script is that it is an independent object which
can be applied to multiple sprites. When multiple sprites are linked to
the same behavior, any change to the behavior will affect all the sprites
to which it is linked. In the same way, a frame behavior that is modified
while occurring in multiple frames of a movie will change every instance
it appears.
Use of the incorrect behavior/script
Often you will not get any error messages when running your movie but it
does not behave in the way you want it to. The likely cause is that the
script or behavior is functioning correctly but you have applied it incorrectly.
You may want a behavior to send the user to one location but it is going
to another. This could be due to a mix-up of attaching behaviors to sprites
or attaching them to the incorrect sprites.
Scripting to frame and cast member numbers rather than markers and names
When you write scripts that send the playback head to another location,
you should always use markers instead of frame numbers. When you write a
script that refers to a cast member, such as switching the cast member assigned
to a sprite or playing a sound, you should refer to the member by name rather
than the numerical cast value. Referring specific names will reduce the
chance of bugs being created when your movie undergoes modification.
Attempting to control the wrong data type
Often different media types have their own exclusive set of properties and
exclusive Lingo to match. For example:
sprite(whichSprite).volume
This sprite property can set the volume of digital video only in a particular
channel represented by whichSprite.
sound(whichChannel)Volume
This is a sound channel property can set the volume of a sound channel represented
by whichChannel.
member(whichCastMember)Volume
This cast member property can set the volume of a Shockwave Audio streaming
cast member represented by whichCastMember.
While all the above properties refer to volume, each is unique to a particular
cast member type.
Looping in a Frame with Transitions
This is a big NO-NO. Transitions use RAM to generate. When the frame is
in a loop with a transition, the transition will tie up memory and may overload
your computer. Transitions also disable interactivity and so any links from
such a frame may not work or will behave inconsistently. It is better to
have a transition in one frame and then have a loop in the next frame. In
this way, the transition will not interfere with any behaviors or scripts
in the subsequent frame.
Different types of scripts can conflict with each other
Director has an internal hierarchy of messages it receives from scripts.
If instructions are placed in the wrong order in this hierarchy, they may
not work. For example, sprite scripts take priority over cast member scripts.
The instructions in the cast member script will be ignored when both scripts
are linked to one sprite.
Outmoded Lingo used
As a beginner, you may be experiencing Lingo for the first time. But, if
you have used earlier versions of Director, you may find that Lingo terms
you were familiar with are no longer used. Each version of Director undergoes
an upgrade of Lingo with new commands and features added and old ones replaced
or removed. It is best to look up code in the Lingo Dictionary to confirm
the syntax and currency of Lingo elements before writing them in a script.
Sometimes the official Lingo support issued by Macromedia does not indicate
what actually works in practice. For example, the pause command has
been deemed as obsolete from Director 6 and Macromedia suggests you use
go the frame instead. However, the pause command still works
in Director 8.5. The difference between pause and go the frame,
which existed at the same time, is that the pause command stops a
movie completely, including stopping, time based media, such as sound or
video.
Me and other parameters
Question: What does the me is scripts mean?
Answer
The term me is a parameter. Look at my technote Using
me and other parameters in Lingo, which explains the concept of me,
it's context in scripts and how to go further with the use of parameters
in behaviors.
You can also look at my Lingo Programming
Definitions page, which briefly defines all the different Lingo terms
used when writing scripts.
Question: How do I write
a simple behavior with parameters that I can set like the ones in the Behavior
Library?
Answer
Look at my technote Using
me and other parameters in Lingo, which looks at parameters starting
with the term me and moving towards creating user defined parameters
in behaviors. More examples of behaviors with parameters are explained in
Understanding Behaviors.
For an explanation of all the programming terms look at my Programming
Definitions page.
Cursors
Question: What standard cursors can Director use via Lingo?
Answer
In Director, you can access the standard inbuilt operating system cursors
or you can create your own custom cursor. The cursor command can be used
with a number of a corresponding system cursor (see picture below), or to
refernce a cast member to act as a custom cursor. Custom cursers need to
follwo certain rules such as amount of colours and size.. Below is a table
of the standards system cursors accessible to Director and their corresponding
numbers.
Question: How can
I create my own custom cursor?
Answer
You could also set the cursor of a sprite to your own custom cursor through
the following Lingo: sprite(whichSprite).cursor = [castMember, maskCastMemeber]
For example sprite(1)Cursor = [1, 2] assigns a custom cursor to sprite
1. The cursor is described as a linear list, where 1 is cast member
1 (the cursor image), and 2 is cast member 2 (the bitmap to be used
as a mask). The cursor bitmaps have to be 12 by 12 pixels and 1 bit.
You can create custom animated or colour cursors with the Cursor Xtra. Go
to Insert > Media Element > Cursor. Play around with the dialog box
that appears. This allows you to have a 32x32 pixel cursor. The bitmaps
can be colour but only 8 bit depth. The cursor will can then be assigned
by the Rollover Cursor Change behavior.
The third option for creating a custom cursor is to set the cursor to blank
(invisible) and then link a sprite to the mouse movement. This can be done
using the behaviors in the Library Palette. First, put the sprite you want
to become your cursor in the last channel of the Score. Attach the Sprite
Track Mouse behavior from the Library Palette to it. Attach a Rollover
Cursor Change behavior to the sprite and change it to blank. You could
do this by the cursor 200 statement. Make sure you move the registration
point of the sprite to wherever you want the your custom cursor to be aligned
to the mouse.
Question: What are
the keycodes for all the KEYS?
Answer
F1 - 122 F2 - 120 F3 - 99 F4 - 118 F5 - 96 F6 - 97 F7 - 98 |
F8 - 100 F9 - 101 F10- 109 F11- 103 F12 - 111 Ins - 114 Del - 117 |
pUp - 116 pDn - 121 Home - 115 End - 119 Tab - 48 Scroll Lock - 107 PauseBr - 76 |
BackSpace - 51 arrow up - 126 arrow down - 125 arrow left - 123 arrow right – 124 |
There are 3 free utilities that gives you any key pressed code at MediaMacros.
Macromedia have a technote on Using
Keyboard input.