a Tuesday feature

by William Hurley

Movie Scripts in Director?

Over the last few weeks I have received a number of requests for me to explain what a movie script is in Director. So today we will cover two major items: the movie script, and the basics of globals.

Globals and movie scripts go hand in hand so it is best that we cover them at the same time. Movie scripts are not assigned to a specific object or place in time in a Director's score. Instead these scripts are available throughout the entire movie. Movie scripts can respond to nine major events from within the score:

It is very important to note that movie scripts can only respond to the keyUp and keyDown events if the sprite is a field in the movie.

Movie scripts are best used when creating global scripts in Director. Globals are functions that can be called from any point in a movie. These are essentially variables within a script that can be shared with other handlers in movies. The following is an example of what the Syntax should look like when creating global variables:

global variable1 [, variable2 ] [, variable3 ]...

The word global acts as an identifier to let Lingo know that the variable listed is a global variable. In doing this Lingo will identify that the variable can be shared by other handlers or movies as global variables. Handlers in Lingo must use the global keyword to identify the variables as global if they are to change (or examine) any of the contents within a global variable. If this is not done, the handler will only treat the variable as a local variable. This is done even when the variable is declared to be a global in another handler in the same movie. A global variable can be declared by one of three things within a movie:

Its value can also be used by other scripts, handlers, and methods within a movie. The following is a basic example of what a simple global variable could look like within Director.

global userMenu
set userMenu = williamsMenu
end

I'll see how many questions this column brings before I move on next week. If there are still questions, I'll write a custom movie script. Until then, keep those questions (and comments) coming.

Past installments of Simply Shocking

http://www.internet.com/