overview meetings assignments links


Communication 111A | Communication and Computers

Fall 2002 | University of California, San Diego

Instructor: Brian Goldfarb

 

Scripting in Director

Note: scripts are not case sensative (exept anmes of cast members and other text which is in quotes.)

Events: Like in life, something that happens. some are user initiated, some are diretor initiated (or internal). Examples are:

Note: some events you wouldn't normally notice (when director loads cast members, when director prepares a frame).

 

Handlers are the basic unit of all scripts. They begin with "on: and end with "end". There may be several handleers in a single script or behavior, but no two should be triggered by the same event.

 

Reading dot syntax: always read groups of text seperated by decimals backward from right to left (except for what is in parenthisis--these are read after what is just to the left of them). When reading substitute "of" for each dot.

 

Variables, Properities and Globals

 

More on Properties: Aside from being variables properties are characteristics of objects in director: sprites, frames, castmembers andmovies all have properties that can be set. Examples:

Testing (properties/conditions) and setting properties

 

Loops:

Message Hierarchy: the order in which diector looks for scripts to execute whenever an event happens.

  1. Sprie
  2. Castmember
  3. Frame
  4. Movie

 

Commenting in scripts: lines of text which begins with "--" will be ignored by director so they can be used for comments or non-executing text.

 

Lists and other more advanced scripting

 

Some guidelines:

1. Use single frame loops when possible rather than linear animations (you can nest linear animations as film loops)

2. Given the choice place scripts in sprites rather than in cast members

3. Give names to your scripts and cast members that make sense to you.

4. when declaring variable, it is good practice to come up with a system of naming that makes sense to you. for example, Itend to give property variables names that start with "p" and globals names that start with "g"