|Page (1) of 2 - 08/23/05||email article||print page|
Dynamic End Jumps in DVD Studio ProTargeting the 'next' button in a sequence of tracks
The great thing about this technique is not just that it will let you jump back to the previously highlighted button in a menu. DVD Studio pro can do that by default. The trick is that this method will let you highlight the "next" button in a sequence of chapters, stories or tracks, which can add a nice, professional touch to your presentation.
There are several cases where this would be desirable--in a training video, in a "deleted scenes" index or in any situation that involves a logical progression of tracks, chapters and stories accessed through a menu. The concept here is very similar to the one we learned in the previous tutorial on jumping to the "last viewed" menu (which you can read by clicking here), except this time we'll be throwing in some mathematical operations into our scripts to help determine, dynamically, which button should be highlighted when the viewer returns to the previously viewed menu. Today's tutorial is fairly intricate, and you should definitely go back and read the previous tutorial before proceeding with this one.
For this project, we'll create a script that will highlight the next logical button in a chapter index menu. Even if this isn't something you necessarily want to do at the moment, it's a good exercise to learn some of the ways in which you can perform mathematical operations in a script to achieve a wide variety of results that can save you a ton of manual labor. (Incidentally, this tutorial can be combined with a previous tutorial I wrote on creating dynamic chapter jumps. This can help you save even more time with projects involving huge numbers of chapters, stories and tracks. If you haven't already read it, you can find it by clicking here.)
Preparation and explanation
This particular project will involve the two scripts we created in our last tutorial, which, again, you can find by clicking here. Those two scripts are the "Menu Prescript" and the "End Jump." If you don't wish to read up on that tutorial, you can download my sample scripts by clicking on the following link:
Download: End Jump Scripts (4 KB)
Click on the link above to download these two base scripts. Decompress the archive. Then, in DVD Studio Pro, right-click (or Control-click) in the Outline tab, and choose "Load Script" from the contextual menu.
Choose the scripts you just downloaded, and they'll be added to your project. The script called "Menu Prescript" should be set as a prescript for all of your menus. The script called "End Jump" should be set as the end jump for each track, story or chapter for which you want dynamic end jump. Our previous tutorial goes into more detail on how to set that up.
As far as these two scripts are concerned, the Menu Prescript can be used without modification. It simply sets the base value to determine the menu currently being accessed. The second script, however, needs to be modified considerably. The single command contained in that script will remain final in the new script. But we'll add five more commands in front of it to make it work.
Now, as it stands, the End Jump script you're using reads the value currently stored in GPRM 0 and jumps to the menu that has that numerical equivalent. In structure, every element in a DVD has a numerical value--each track, each menu, each chapter, each little button. Even scripts themselves have a numerical value. In this case, we're dealing with menus and buttons. The numerical value of a menu is, simply, 32 times the menu number in its order in the Outline tab. for example, if you have three menus listed in your project, the first one is 32; the second one is 64; and the third one is 96. So, for example, if we store the value 96 in GPRM 0, then use a Jump Indirect command with a target of GPRM 0, it will always go to Menu 3.
Similarly, every button in a menu has a numerical value that a script can use. This number is the number of the menu plus the number of the button minus 1. So Button 1 on Menu 2 is 64 (same as the menu itself); Button 2 on Menu 2 is 65; Button 3 on Menu 2 is 66. Et cetera.
All we have to do is figure out a way to get the information on which button in which menu the user selected to watch a track, then add one to that number and use the result in our final Jump Indirect command. For example, if the user pressed Button 3 on Menu 3, we get a numerical value of 98. But we want to add 1 to that so that the next button--Button 4--will be highlighted when the viewer returns to the menu.
So obviously, to make this happen, the order of your buttons in critical. Make absolutely sure that they're in the proper order, or this won't work right. Select each button and check its number in the Inspector palette. You'll see the number of the button at the top right of the Inspector palette next to the button's name.
Finally, by way of preparation, you should make sure that each menu to which you're applying these scripts has as it's last button some sort of "next" or "previous" or "return to main menu" button--some sort of link other than a track/chapter/story link. The reason for this is that we're adding numbers together that will take us beyond the total number of buttons on any given menu. So, after the viewer clicks on the last track/chapter/story button, there should be another button that the user can return to, rather than experiencing a frozen DVD.
So just to try to make this a little more clear, let's say you have three buttons on your menu, each linking to a track that will use the dynamic end jump script. These buttons are Button Nos. 1 through 3. There should also be a Button No. 4 on this menu that will be highlighted after the final chapter, story or track is viewed.
The modified 'End Jump' script
Okay, so now that you know what we're doing and why we're doing it, it's time to look at how to do it. To begin, double-click on the End Jump script in the Outline tab to open it in the Script Editor. Add in five new commands, and then drag the original "Jump Indirect" command to the end of the script.
Commands 1 and 2. Now, for our first two commands, we're going to throw in a little math just to straighten out the value stored in GPRM 0. The reason for this is that if we don't clear out GPRM 0 down to its base value (of 32, 64, 96, etc.), the values in this field will continue to grow each time the script is used, rendering it useless. So what we'll do is first divide the value of GPRM 0 by 32, then multiply it by 32. The division operation will always round the result down, simply discarding the remainder so that, for example, 42 divided by 32 will equal 1. Then we'll multiply it by 32 again to bring it to the base value of the menu that was last viewed. (This number will also be refreshed each time the user selects a new menu.)
So, for the first command, set it to "Set GPRM." Make the Operation "div" (for "divide"); set the Source Type to "Immediate;" set the Value to "32;" and set the Target to "GPRM 0."
And for the second command, do exactly the same thing, but set the Operation to "mul" (for "multiply").
And those are our first two commands.
Related Keywords:apple dvd studio pro, end jumps, highlight next button, select next button, scripting
Source:Digital Media Online. All Rights Reserved