|Page (1) of 1 - 07/17/06||email article||print page|
There's more than one way to do this, but I though I'd take this opportunity to show you a fairly straightforward method for scripting a solution to this problem. It's nothing terribly advanced, but it will help you not only solve this problem, but get an idea of how scripting works in DVD Studio Pro as well.
Before you get started, if you have absolutely no idea about anything having to do with scripting, you might want to go back and take a look at some of our previous scripting tutorials, which provide you with an introduction to scripting and are designed to give you a broad awareness of various scripting techniques, which may be applicable for you even if you don't have any particularly pressing need for the specific scripts involved in the tutorials. You'll find links to those articles at the end of this page.
How these scripts will work
Before we dive into the actual scripting here, we'll first look at the concept involved. Each menu can have a prescript attached to it. Using a prescript in this case, we'll store certain values, which we'll then reference later in our main script. to determine which was the previously viewed menu on our DVD and, therefore, which menu the Menu button on the remote control should take the viewer to.
For example, if the viewer navigates to Menu 1 (say the main menu), we'll store a value of 1 in one of our memory banks. Then, later on, when our main script is invoked, the script will check to see which number is stored in the memory bank, and take the viewer to the appropriate menu based on that number.
Those "memory banks" are called GPRMs.
This entire procedure will be scripted out manually, which will make it easier for you to see what's going on, though there are quicker ways to do it once you have a better grasp of scripting in general. Again, this is just one method among many.
Creating the base prescripts
For this example, we'll assume that there are three menus in our project. We'll just call them Menu 1, Menu 2 and Menu 3. Each of these menus, using this method, will require its own separate prescript, which is the script that will store a number in our GPRMs ("memory banks"). So we'll have three scripts, one for each menu, called Script 1, Script 2 and Script 3, respectively.
So let's get right to that.
With your project open in DVD Studio Pro, choose Project > Add to Project > Script (shortcut: Command-apostrophe). If you look over in the Outline tab, you'll see that this has added a new script called Script 1.
Double-click Script 1 in the Outline tab. This will activate the Script window down below the main menu viewer window.
What you see there is a single command labeled "Nop." This is basically just a placeholder command. Click once on it, and then look over at the Inspector palette. In the Inspector palette, you'll see the command listed there in a pull-down menu.
Click on this pull-down menu, and select "Set GPRM" from the list of available commands.
Once you do this, you'll see several more options listed. Here's how we're going to set those options:
Source Type: Immediate
Source Value: 1
Target: GPRM 7
What does that mean? Our target is GPRM 7. That means we're using "memory bank 7" to store our number. Why 7? Just for the heck of it. You can easily use any of the eight available memory banks (GPRM 0 through GPRM 7), but I've arbitrarily chosen GPRM 7.
The "source type" parameter of "Immediate" simply means that we're going to set a value in this memory bank manually, rather than using a more advanced feature to set the value dynamically.
And the Source Value of "1" simply means that the number we're going to store in GPRM 7 is 1.The number 1 is an arbitrary value, as you'll see later on, but we'll use it here just to help us keep things straight. This is Script 1, which will be used on Menu 1, so we'll set a value of 1 here so that we don't get confused later on.
Now, believe it or not, that's the first basic prescript in its entirety. Just one simple command that, right now, probably seems meaningless. But it will make sense once we get to the next section.
Right now what we need to do is create two more scripts like this one.
To make things easy, we'll just duplicate the script we already have. To do that, click once again on Script 1 in the Outline tab, and then type Command-D to duplicate the script. Then type Command-D to duplicate it again. You should wind up with three duplicate scripts now named Script 1, Script 2 and Script 3.
Double-click on Script 2 to activate it in the Script window. Then click one the single command that it contains. (Even though it's already selected, you need to click on it.) Once you do that, look over in the Inspector palette, and change the Source Value to "2."
Now double-click on Script 3 in the Outline tab. Then click on the one command it contains down in the Script window. Then, again, go to the Inspector palette, but this time set the Source Value to "3."
Okay, now we have our three base scripts ready, and we can attach them to our three menus.
Setting prescripts for menus
Right now, the three scripts we created do absolutely nothing. What we want to do is set them as prescripts for our individual menus. That way, when the user goes to Menu 1, for example, Script 1 will be automatically activated, and a value of 1 will be inserted into our GPRM 7 "memory bank." When the viewer goes to Menu 2, Script 2 will be invoked. And when we go to Menu 3, Script 3 will be invoked.
Here's how that works.
Click on Menu 1 in the Outline tab. Then, over in the Inspector palette, click on the Advanced tab.
Right in the section labeled "Playback Options," you'll see a pull-down menu labeled "Pre-Script." The value is currently set to "Not Set." Click on the pull-down menu, and choose "Script 1 from the list of available scripts.
Now click on Menu 2 in the Outline tab, and go over to the Inspector palette again. This time, set the prescript to Script 2.
And, finally, click on Menu 3 in the Outline tab, then, in the Inspector palette, set the prescript to Script 3.
The main script
We are now done with the prescripts. But still they don't do a whole lot. Whenever you navigate to Menu 1, Script 1 will be invoked, and it will set GPRM 7 to a value of 1. And it will do similar things with the other menus. But now we need to create a script that will use the values we store in our memory banks to help us navigate back to the proper menu.
So choose Project > Add to Project > Script. This will add a new script to our project labeled "Script 4." This is our final script for this project. Double-click it to open it up in the Script window, where, once again, you'll see that single default "Nop" command.
Click on the Nop command, and then look over at the Inspector palette. In the command pull-down menu, select "Jump." Several new options will become available to you.
The first change we'll make is to set the "Jump To" parameter to "Menu 1." So click on the pull-down menu, and choose Menu 1 from the list of available options.
Now what we want to do is to set a condition on this command. In other words, we want to jump to Menu 1 only if the current value stored in GPRM 7 is 1. Why? Because if the current value in GPRM 7 is 1, that means that Menu 1 was the last menu viewed, and so that's the one we want to jump to.
So, to set this condition, click on the checkbox in the Inspector palette labeled "Compare Command." Then sett he following values:
Execute If: GPRM 7
With Value: 1
Now we need to add a second command to this script. Since the three commands we use in this script will be nearly identical, we'll save a little time by duplicating the existing command. To do this, click on the command in the Script window. Then copy it (Command-C) and paste it (Command-V). Then paste it again (Command-V) so that you have a total of three commands in this script.
Click on command 2 in the Script window. Then, in the Inspector palette, set the Jump To parameter to "Menu 2." And then, down in the compare command section, set the "With Value" parameter to "2," like so:
Then click on the third command in the Script window. In the Inspector palette, set the Jump To value to "Menu 3." And again change the "With Value" parameter down in the Compare Command section to "3."
And here's how the script now looks in the Script window:
Makes sense, right?
That's it for this script. Now all that's left to do is to attach the script to the Menu button on the remote control.
Attaching the main script to a remote button
Again, our latest script still doesn't do anything for our DVD because it's not attached to anything yet. So what we want to do is to assign this script to the Menu button on our remote control. This way, when the Menu button is pressed, Script 4 will run and will jump to Menu 1, Menu 2 or Menu 3, depending on which was the last-viewed menu.
To do this, click the disc icon in the Outline tab.
In the Inspector palette, in the "General" tab, you'll see a section labeled Remote Control. Choose the pull-down menu labeled "Menu," and set the value to "Script 4."
And that's basically it, unless you've manually changed this remote control value in other elements of your DVD, such as any tracks or stories. So click on each track and story your project contains in the Outline tab. Then, in the Inspector palette, make sure the Menu remote control function is set to "Same as Disc" (for Tracks) and "Same as Track" (for stories). Or, if you wish, you can also set it to "Script 4," which will have the same effect.
Okay, you now have a fully functioning set of scripts that will take your users back to the previously viewed menu. If you have any further questions, be sure to visit me in the DVDSP forum at DMN Forums BY CLICKING HERE.
And, if you'd like to view any of our previous tutorials for DVD Studio Pro, you can access them via the links below.
DVD Studio Pro Scripting, Series 1
- Part 1: General scripting information
- Part 2: Creating an interactive quiz
- Part 3: Keeping track of time
- Part 4: Pausing and resuming a timer
- Scripting Dynamic End Jumps
- Scripting End Jumps
- GPRM Partitions, Part 1
- GPRM Partitions, Part 2
- Loop points in DVD Studio Pro 4
- Scripting dynamic chapter selections
- Scripting system streams, Part 3 (audio switching)
- Scripting system streams, Part 2 (audio menu)
- Scripting a dynamic 'play all' button
- Scripting system streams, Part 1 (subtitles)
- Scripting previous/next buttons for menu navigation
- Reusing Menus in DVD Studio Pro
- Antialiasing Highlights in DVD Studio Pro
- Subtitles and Fonts in DVD Studio Pro
- Button Trickes in DVD Studio Pro 4, Part 3: Rollover Effects with Saturation
- Button Trickes in DVD Studio Pro 4, Part 2: Button Tint, Saturation and Opacity
- Button Trickes in DVD Studio Pro 4, Part 1: Button Rotation
- Custom Patches in DVD Studio Pro 4, Part 3: Custom Shapes
- Custom Patches in DVD Studio Pro 4, Part 2: Highlights
- Custom Patches in DVD Studio Pro 4, Part 1: Motion Masks
- Menu Text and Line Spacing Issues
- Menu End Jumps in DVD Studio Pro, Part 1
- Frame Interpolation/Standards Conversion in Compressor 2
- VTS Allocation
- Switching System Streams with Buttons over Video
- DVDSP General Walkthrough
- Customizing Button States
- Highlights and Overlays
- Zoom Masks
- Customizing Masks
- Fixing color shift (for DVDSP 2.0)
- Motion Masks (DVD Studio Pro 2)
- Remote Rollovers
- Setting Up DTS Playback on the Mac
- Creating Alpha Transitions, Part 1
- Quick Tip on Stories
- Alpha Transitions, Part 2
- Delaying Button Highlights
- Buttons over Video
- Media Storage
- Creating a "Play All" Button by Merging Tracks
- Display Conditions and Prescripts
- Bitrates in DVD Studio Pro
Related Keywords:dvd studio pro, scripting, last menu, previous menu, tutorial, dvd authors
Source:Digital Media Online. All Rights Reserved