Score scripts can be attached to any cells or frames in the script. They appear in the pop-up Script menu at the top left of the score window (when the score is set to show the script menu, that is). Handlers contained within them are only accessible to ordinary events while the frames in which they appear are playing.
Movie scripts and the handlers they contain are globally accessible - they can be called from anywhere in the movie, by score script handlers, cast scripts, other movie scripts or events.
Both score and movie scripts are elements in the cast in their own right. You can choose whether a script is a score or movie script from the pop-up menu in the script info dialog box.
Cast scripts do not appear as separate cast members in themselves, but only as adjuncts to the bitmap, button or whatever they are attached to. They appear in the script window as "Script of cast member x". In general they respond only to events passed to the cast member they are attached to.
Messages normally pass through scripts in the order specified in the "Lingo Messaging Hierarchy" diagram on the back cover of the Lingo Dictionary, stopping as soon as they find a script with a handler that can use them. They can be made to continue down the hierarchy by using the pass command:
-- this is a sprite script on mouseUp -- do some sprite things first here mySpriteStuff -- then pass it on pass end mouseUp
This will send the mouseUp message along to the cast, frame and movie scripts once the sprite is done with it.
Although messages will only normally be passed in the order specified in the messaging hierarchy, it is possible to send messages directly to a specific script via lingo, even if that script would not normally receive such a message, using the script keyword:
message(script scriptName [, params...])
For example, suppose you wish to invoke the mouseUp handler in a castmember that isn't presently onstage. If the cast's name is "blah", then:
mouseUp(script "blah")
will do just that. This kind of thing should be done with care, however. In general, it's sensible to place your scripts in the appropriate places in the messaging hierarchy for the things you want them to do.