All About PuppetSprites

Date:    Mon, 24 Oct 1994 23:23:53 -0500
From:    Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK>
Subject: Re: puppetsprites: set to false after using or not?
The deal with puppets is this:
  puppetSprite X, true
means "never mind what the score says, from now on you do what I tell you, got that channel X?"
  puppetSprite X, false
means "all right score, you can have channel X back now to do with as you wish."

Once you set the puppet state of a channel, it stays that way until you change it - a sprite is either under score control, or else it's under script control, but not both.

The tricky bit is that neither state manifests until something is explicitly instructed by the controlling entity: even after you set the puppet property to false, the score will only reassert control when it explicitly has to do something with the sprite, ie when a transition, jump or move happens.

So, for simple changes, it is *possible* to do what you did (puppet, switch cast, unpuppet) and for it to *seem* to work for a while, but as soon as the score has to do something different (eg a transition) your cast switch gets forgotten and the old castmember returns.

OTOH, if you leave a sprite puppetted and jump somewhere else in the score, the sprite will ignore what the score says it should be doing after the jump, and stay as you left it when it was under lingo control.

So, the guiding principle is: keep sprites puppetted for exactly as long as you want them to be under lingo control, and unpuppet them immediately before the score does something you want the sprite to reflect.

How you go about this is up to you, but there are three basic schools of thought:

  1. never use puppets and put everything in the score. Use lingo only to control the flow of the movie, not to alter the content.
  2. never use the score at all. Put dummy sprites in all channels at the start, puppet them all, then just loop on the frame, controlling everything via lingo.
  3. use the score to maintain the gross structure of the movie, keeping different sections of the movie in different frames or sets of frames. Elements which don't change, or which change in a constant way can be left unpuppeted, but sprites which need to be kept under lingo control should be puppeted as soon as you arrive in the section, and left as puppets until you leave the section. Just before you jump away again, issue [puppetSprite X, false] commands.

(1) is unwieldy for anything beyond the most basic slideshow structure. It is possible to do more complex interactivity this way, but the greater the complexity, the less appropriate this method is. (2) is more efficient and has at least 1 vocal advocate on direct-l [hi Simon! - saw you got a mention in the Observer this week], but is intimidating for those unused to programming, and can be a pain during development. (3) is the one I'd recommend, using the score as a sort of outliner, but doing the local colour in lingo. If you do this, you must unpuppet all sprites before jumping to some other section.


There are a couple of rules of thumb that I follow.

  1. Don't set puppetSprite to TRUE in a channel that doesn't have something in it.
  2. Once set to TRUE, if the channel no longer has something in it, the sprite will remain on the screen. Therefore, always reset your puppetSprites to FALSE when you go to a set of frames that have a different set of puppetSprites. I typically do this as I LEAVE a set of frames that use puppetSprites. I have a routine called AllPuppetsOff() to do just that.
  3. Use lead in frames to set your puppetSprites properly. For example, use a lead in frame that has just your background art. Set the various channels that will be puppetSprites to invisible. Go to frame the frame + 1. Set the puppetSprite TRUE in all channels with puppetSprites. If you need to change the sprites location, do it now. Set all invisible sprite visible. Call updateStage. Go to frame the frame + 1. Loop on this frame.
  4. Don't try to do anything in the first frame of a movie. Just put background art there, or leave it black, depending on the effect you want. Start any scripting in frame 2.