Scripting? What’s Scripting?

Scripting is considered­­by some­­to be a form of simple programming, but you should not be deceived by the term simple, and you should definitely understand that it is programming.

Many Director users, some of whom I know to be quite superb programmers, feel a certain sense of inferiority toward people who work with "real" programming languages such as C++; and to be fair, some such "real" language users look down on anyone who uses a scripting language, the implication being that it’s so simple a chimpanzee with its brain removed could do it (and thus, by extension, the Director programmer is such a primate).

I think that’s just jealousy, because a good Director programmer can often do, in a few weeks’ time, what it takes a good C++ programmer several months to complete (which really annoys the C++ programmer). Besides, many of those same C++ programmers don’t hesitate to use tools like Perl or Java, both of which are also scripting languages!

What might start as a pretty basic method for moving from one screen to another can rapidly develop into something much more closely approximating a full-fledged programming environment, and this is what indeed has happened with Director and its scripting engine, Lingo.

What makes Director stand out as compared to scripting environments such as Java, Perl, or Python is the fact that it comes packaged with an exhaustive­­to many new users bewildering­array of rich-media components and controls.

These components include tools for placing text onscreen, for creating graphics right inside Director itself, for manipulating digital video (Apple’s QuickTime is an example of this), and for handling sound effects such as music or narration. They also provide the ability to play back and respond to commands from animations made in Macromedia Flash.

By the end of this part, you’ll be familiar with many of these components, and you will know enough about the rest to be able to work with pretty much all of them. In fact, by the end of this part, you’ll be quite capable of putting together some very interesting Director programs, to the point you might consider starting your own business doing so, or at least enhancing your current income by doing some smaller jobs on the side. I say go for it!

Other Scripting-Style Programming Environments

Other packages out there allow you to do something similar to Director, of which the major contenders currently include MetaCard and AuthorWare. However, AuthorWare uses a flowchart approach (icons connected by lines) to placing things onscreen and controlling interaction with users, and it does not allow as direct access to its scripting tools as Director does; MetaCard, while it gives you more ready access to its script engine, is built on a card-stack approach (similar to the one HyperCard uses).

Many people, including me, find such modes of working to be difficult once the really heavy programming starts happening, which is why I’ve found Director’s method to be preferable. To be sure, both the card-stack and flowchart approaches are pretty easy for many newcomers to get the hang of, but after a few years they’ve more or less exhausted their possibilities for enhancement, and that might leave the programmer hankering after something a little more meaty.

By contrast to these other programming packages, Director’s script engine, Lingo, is actually so powerful that you can use it to permanently modify Director files­or even create new Director files without using any of the items that are provided to you by Macromedia. (A Director file is a collection of text, graphics, and other interesting media objects, packaged with Lingo scripting, which is used by Director to put things onscreen­in short, a program.)

Note: A file made using Director called a movie, is to Director what a document file (such as a letter or term paper) is to a word processor program. This can be somewhat confusing out of context, because (for instance) things made in Flash and QuickTime are also called movies. In this text, when I use the term movie I am describing a program file made using Director, unless I explicitly say otherwise. Such techniques are often referred to as working on-the-fly, meaning that you might start with only a set of commands you’ve created in Lingo, and end up with a complete Director movie you’ve made out of nothing at all. (That sounds pretty complicated, and believe me, it is. Don’t worry; you won’t have to tackle anything that involved here, but it might really intrigue you to know that you can do it. And once you’re done with this book, you will have all the knowledge you need to begin experimenting along those lines yourself.)

When Lingo elevated its power over Director movies to its current level, at about version 4 of the Director program, the software became fractally more sophisticated than it had been in previous versions. (Fractal levels of sophistication are effectively bottomless­regardless of how deep you go, there’s always more you can do.) Director was the first multimedia engine ever to allow self-altering code to this extent, and the concept of self-altering code is itself so involved that you can do entire doctoral dissertations in computer science on just one element of its implications. Prior to this change in the Director engine, no multimedia scripting environment that I know of afforded anything like this degree of power to its programmer (you, of course!).

Not bad for a "flash-and-glitz" engine that "just" uses scripting, that’s "only" used to make games. (So much for those myths!)

With the modern Director engine, you can make something as simple as a text editor, as prosaic as a World Wide Web browser, as useful as a file indexer, as fun as a finger-painting program, or as thrilling as a 3-D action/adventure game. Furthermore, Director’s power lets you include the ability to change these programs after you have written and distributed them, or even let the user make his own changes­and thus permanently alter the way the program runs. It is this combination of relative ease of use for the programmer added to a lot of power that can be made available to end users that I think is the single most exciting thing about Director.

So now that you’re slavering after some of this power for yourself, it’s time to break into the world of programming with Lingo and Director. We’ll begin our foray by looking over the most obvious things you see when you run Director­the things you’ll end up using the most.