Scripting Overview

Scripts you add to your project contain commands that allow you to access the functionality available in all DVD players. Each script can contain up to 124 commands.

Every DVD player contains a micro-controller that can execute a set of commands defined by the DVD-Video specification.

The commands defined in the DVD-Video specification are at the level of microprocessor machine code, with very simple commands used to initiate desired functions. You may find that some of the concepts and terms are a challenge. Therefore, when learning scripting, proceed with initial deliberateness and caution—it is very easy to author titles with scripts that just don’t work. You should also use the Simulator and test builds of your project using the Apple DVD Player to verify that your title plays back exactly as intended.

About DVD Player Registers

Each DVD player has two types of memory registers: General Purpose Register Memories (GPRMs, also known as variables) and System Parameter Register Memories (SPRMs). Scripts interact with these registers to determine DVD player settings (such as language and parental control) and to control various aspects of disc playback.

Scripts use GPRMs as temporary storage, or “scratch pads,” while executing their commands. DVD Studio Pro provides access to eight 16-bit GPRM registers, designated GPRM 0 through GPRM 7 (though they can be renamed). DVD Studio Pro includes the ability to partition seven of these registers into multiple smaller registers. For example, you can partition GPRM3 into four 4-bit registers. Each register is independent of the others, and all are cleared whenever a disc is inserted into the DVD player. The registers can be used as storage locations or as countdown timers.

In contrast, SPRMs have rigidly defined functions. There are 24 of them, designated SPRM 0 through SPRM 23. See System Parameter Register Memories Details for a detailed listing of their functions.

Scripts spend a lot of time copying values from an SPRM to a GPRM, extracting information from the values (for example, determining the language setting), and then acting on that information (selecting the proper audio stream to play). Extracting the information can be challenging, requiring a bit of skill and programming knowledge.

About Scripting Commands

You can choose from ten scripting commands when building your script. Each scripting command has its own set of controls that fit the command’s function. Each script can contain up to 124 commands, or operations. Depending on how you configure the scripting command, it might use up to 16 of the 124 commands. The top of the Script Inspector shows the number of commands used and available. A dialog appears to warn you if you create a script with too many commands, and the Script Inspector shows the commands used and available values in red, with a negative number for the Commands Remaining value.

Each scripting command creates a command line that appears in the Script Editor. You are provided with a variety of tools to rearrange the order of the command lines in the script, which is important because the command lines are executed in order (though it is possible for a command line to jump to any other command line in the script).