Fred Endsley
Puppeting Issues and Tips:
Setting Sprite Properties:
Many sprite properties are set through the score or menu options. When a sprite channel is puppetted those properties are frozen and can only be changed by lingo or depuppeting.
Some of these sprite properties can be set or changed for single or multiple sprite frames and channels without using lingo. Obvious examples are: changing the fore or backColor, ink effects, transitions, tempo, scaling, making sprites movable, setting trails, making loops, making editable fields, making sprites visible or invisible with inking, setting colorDepth, etc.
Many sprite properties and movie functions can be effectively set or changed with lingo, without puppeting. However, these settings generally require movement of the playback head to enact, and often revert when the movie leaves the last frame or loops back through the first frame.
Examples of using lingo without puppetting:
- set the visible of sprite 1 to TRUE/FALSE
- cursor 200 (etc.)
- go to . . .
- play/playdone
- if . . . then . . . (most statements not requiring handlers)
- if rollover
- if the mouseCast
- pause/continue
- sound playFile
- sound fadeIn/Out
- set the volume of sound
- if soundBusy
- delay
- startTimer
- set the timeoutLength
- set the regPoint of member
- preLoad/unLoad
Puppetting becomes necessary and useful when sprite properties need to be changed
immediately without leaving a frame (updateStage), while the playback head is paused, or when sequential sprites in a channel need to be consistently varied.
To maintain clear control of sprites, its essential to understand when and where to best puppet and to de-puppet. Otherwise chaotic things can happen that make debugging unnecessarily complex. Keep in mind that once a sprite is puppetted (eg. puppetSprite 1, TRUE) everything that follows in that channel is also puppetted (inc. open frames) until that sprite channel is depuppetted (puppetSprite 2, FALSE).
- Don't arbitrarily puppet sprites that don't need to be under puppetted-lingo control.
Generally, you only need to puppet sprites whose properties or identities will be changed.
- Don't puppet a sprite channel during an empty frame. If a sprite cell is empty when it
is puppetted, it will remain empty until depuppetted.
- If you puppet in a movie script, only puppet those sprite channels that are and will be
consistently filled with sprites that will be controlled by "puppetted lingo commands".
Otherwise, puppet and depuppet sprites within individual frame and button scripts as
needed. Avoid globally puppetting sprite channels - they remain puppetted
between linked movies.
- If you "bulk-puppet" sprite channels using a "repeat with channel..." statement, make
sure the referenced channels are filled and need to be puppetted. Turn off puppets
individually (puppetSprite 4, FALSE) or in "bulk" (again with "repeat with channel...")
as soon as they are no longer necessary.
- If you create handlers (eg. puppetsOn / puppetsOff) to puppet and depuppet multiple
sprites, follow all the above recommendations.
- Puppets need to be turned off to return control of affected sprite properties to the
score. Turn puppets off before moving to a non-contiguous section of the score.
- Try not to puppet during a "transition" frame - the stage is controlled by the transition which can preclude many other functions. If possible, add an extra duplicate frame for the transition to occur in before the puppetting and property-changing frame.
This is also, and especially, true for looping frames (whether puppetted or not) in
which a transition can block the appearance of the cursor and other property
changes.
- Remember that lingo statements enact in the order that you write them. To use a
puppetTransition when going to a new frame, use this order:
puppetSprite(s) . . ., FALSE (if any applicable)
puppetTransition . . .
go to . . .
- When using puppetSound, it uses sound channel 1, and that sound channel 1 will continue to be a puppet (thus unusable for other nonpuppet sounds)
until you depuppet it using: "puppetSound 0".
- Remember that changes in sprite properties will not be redrawn until the playback
head moves or the "updateStage" command is given. This can be especially
important if the tempo is slow or for immediately playing puppetsounds. If several
puppetsounds need to be played sequentially or other sequential property changes
must occur within one frame, an updateStage command can be used after each.
- Be careful when using multiple "time" settings in one frame, like the tempo setting,
puppetTempo, length of transition, puppetsounds, sound loops, soundBusy, timer
settings, delay, etc. Usually something will suffer. Keep it simple and understandable.
- Assume nothing when dealing with puppets. Build your scripts incrementally.
Test often to avoid amassing an overwhelming spiderweb of chaos.
- As your scripts grow, create "nested" handlers and sub-routines to isolate and clarify the mapping of events. Use "--" to insert comments for clarification, or to deactivate
lines of script for testing.
Remember, there are usually several ways to script the same thing, and no particular
method is more correct. Copy, read, and test other people's scripts until the language
becomes understandable. You will gradually become fluent.