|Page (3) of 3 - 02/08/05||email article||print page|
Scripting a Dynamic 'Play All' Button in DVD Studio Pro 3A universal method for adding 'play all' functionality to any project Script 3: Clearing out GPRM 4
Our final script is the simplest. It's sole purpose is to clear out any values stored in GPRM 4 so that when the user returns to the main menu and hits the Play All button again, the script can start fresh. This will be a menu prescript, so name this new script something like "Menu Prescript."
The only command you'll place in this script is a simple Set GPRM, where you use the Immediate Source Type to set the value of GPRM 4 to 0. This is illustrated below.
So now you should have three scripts with a total of six commands. Not too much work for this sort of this, eh? But now we need to put it all together to make things work properly.
Putting it all together
Your scripts, of course, must be attached to something in order to work, so now we'll look at how to do that. But before we begin, make sure you have all of your tracks listed in the Outline tab in the order in which you will want them viewed when the user selects your "Play All" button. If they're not in the correct order, you can simply click and drag on them to move them into the proper order. This will not affect the functioning of any links you currently have in your project, but it's critical to the success of our new set of scripts.
That done, you'll first want to create a "Play All" button. This can be a graphic or text; it doesn't matter. Just create a button in your main menu that will be used to play all tracks in sequence. To this button, you will attach our first script, "Play First," as the Target in the Inspector palette.
Next, you need to assign our second script, "Play Next," as the End Jump of all of your tracks. This way, when any track finishes playing, it will run the Play Next script to determine whether it should now play the next track or go back to the main menu. (If the user has clicked the Play All button, the script will move on to the next track. If the user has played an individual track, the script will return the user to the main menu.) To do this, simply select each track in the Outline tab, and then, in the Inspector palette, set the End Jump of the tracks to "Play Next," as seen below.
That applies to all of your tracks EXCEPT the final track in the sequence, whose end jump should be your main menu. In my case, that means the Fourth Track will have an End Jump of Menu 1, as seen below.
Finally, we need a method to clear out all of the information in GPRM 4 for the next time the user decides to play a track. Otherwise the values in GPRM 4 will just keep adding up, and nothing will work correctly. To do this, we''ll use our third script, "Menu Prescript," as a prescript for our main menu (or all of our menus, depending on how your project is set up). To do this, click the menu in the Outline tab. Then, in the Inspector palette, click on the Advanced tab, and set the Pre-Script value to "Menu Prescript," as seen below.
That's all there is to it. You're now ready to test this project. And remember, since these scripts are dynamic, you can keep adding tracks to your project without writing any new scripts. Any new tracks you add will automatically be added to the queue in the order in which they are listed in the Outline tab. ANd remember, since these scripts are dynamic and universal, you can save them out and use them in any other projects you might be working on. To do this, right-click (or Control-click) on each of the scripts in the Outline tab, and choose "Save Script" from the contextual menu.
You can load these scripts into a new project by right-clicking in the Outline tab and choosing "Load Script" from the contextual menu.
Speaking of which, now that you've gone through this complete tutorial, you can, if you wish, download my own three scripts used in these examples by clicking on the following link: NagelScripts.zip (4 KB).
Ah yes, and if you're looking for more tutorials on DVD Studio Pro--script-related or otherwise--we have tons available. You'll find links to all of them 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
DVD Studio Pro Scripting, Series 2
Part 1: The basics of working with SPRMs
Part 2: Bit-wise operations and binary number conversion
General design and authoring topics
DVDSP General Walkthrough
Customizing Button States
Highlights and Overlays
Fixing color shift (not an issue in 3.0)
Motion Masks (custom patches)
Scripting, Part 1
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
Creating a "Play All" Button by Merging Tracks
DVD Studio Pro 2
DVD Studio Pro 3
If you have any further questions or any bugs to report--or if you just feel like saying hello--please feel free to contact me in our DVD Studio Pro user forum by clicking here.
Related Keywords:apple dvd studio pro, scripting, authoring, play all button, dynamic scripts
Source:Digital Media Online. All Rights Reserved