Archive for scripting
Keycode Access to play clips

image of the keypad used in the sample project
An interesting thread on the Apple Discussions recently talked about whether it is possible to use a menu screen with a number pad graphic so that users could type in a clip number to play a clip. In the thread, the requirement was for 550 clips, and the original poster referred to them as ‘tracks’. Clearly, you can only have 99 tracks, so you always put all of your material into a single track and use markers to set the start/end points between the clips. The only other constraint is that a track can only have 99 markers in DVDSP. With 550 clips you’d need 6 tracks, and to keep the number of markers lower, you’d put just 50 clips into each of the tracks you use.
So then came the scripting – how do you keep track of what the user typed, and send them to the relevant marker? It’s actually a lot easier than you might think, using the button values on the menu to determine the clip value. The harder part comes when you have to do the jumps to the clips. When you write a script you only have 128 commands at your disposal. With a jump statement that includes an ‘if’ clause, you’ll get through those very fast and need quite a few scripts for 550 clips. Additionally, the scripts would go through sequentially, making finding the right clip a chore, and probably creating quite a pause.
The answer is to create a script for each clip that has just a single jump statement to get to that clip. The genius part here is that you use a ‘Jump Indirect’ to get the right script and so massively reduce the time for the player to get from the selection script to the playback. Don’t forget that DVDSP has a pretty hefty abstraction layer and there are lots of ways to slow things down, so anything you can do to help reduce delays is going to be good.
The remainder of the job is to add menu calls and end jumps to the markers – in the sample project I just sent everything through a script that clears the GPRMs and goes back to the main menu. Additionally, I had to add some logic to deal with the user selecting clips that didn’t exist, and to allow them to use a leading zero in their number, for selecting clip numbers 1 through 9.
The sample project file is here. You’ll probably need to reconnect the images I used for the track when you open the project.
Creating Random Menus, or random anything!

Scripting Random Menus
A new tutorial on the site deals with a number of ideas for making random menus appear for the user. You might well ask what the point is in making this kind of thing, but it is all about enriching the user experience for your disc.
Consider the scenario where you want to reveal slightly different information each time the user visits a particular menu. Or how about adding an easter egg button to only one menu in a set of 10? What about just for visual interest, changing the background image every time that menu is accessed?
The tutorial shows you ways of achieving all of these things, and with your own ideas added in to the mix there is a lot that can be done to improve the quality of your projects. There are files available for download, and the scripting is all explained in the tutorial. It’s very short, and pretty simple, but does rely on using the ‘Item Values’ for menus. If you are not sure about this, you can find out more about item values on this site, too!
Click Here to get to the new tutorial, or follow the links on the left!
Advanced Scripting Techniques, Random Playback Scripts
A new tutorial exploring the use of advanced scripting techniques has been created, which uses bit based techniques to generate a random number and jump to a track or story. It checks to see if the track or story has been played before and if so generates a new random number.
The tutorial is theoretical, and doesn’t have a set of files to download yet, but looks at how to track up to 40 tracks/stories. This means that the tracking has to use 40 bit slots, or two and a half registers, leaving the remainder for calculations. This is more than enough, and in fact twice the number of clips could be tracked using this technique.
As it is only theoretical, there may be some flaws in the scripts, but it is offered as a starting point for experimentation and discussion. It uses fairly basic maths for the most part, but makes use of the ‘AND’ operator to compare two GPRMs. Previously, the ‘and’ has been used almost exclusively on this site to mask off different sets of bits.
The tutorial can be found here:
http://www.dvdstudiopro.co.uk/scripting-advanced-random-playback/
Simple Non-Repeat Quiz
More and more frequently we are being asked to help with making quizzes and other features to complement the DVD material. Sometimes this is a simple quiz where a number of questions arrive on screen and can be answered by any viewer, and sometimes they are far more complex with all kinds of game-play aspects to include.
Our advice is that you need to keep in mind the limitations of DVDs for this kind of thing. Whilst you can make superb quizzes, you are restricted by the number of memory slots as to how extensive the question selection and scoring can be. Trying to recreate a four player or team quiz complete with scoring and taking turns is a pretty complex task. Equally, having loads of questions in the quiz makes tracking what has been asked all the more difficult.
However, plenty of very simple quiz games can be made and the following link will download an ultra simple non-repeating quiz with just five questions. The idea is that you see what is involved in making the quiz rather than take it and use it as a template for a bigger game. Random question selection and tracking can be done in several ways, not only the way it is done here, for example. You may need more scripts of better structures if your quiz is reasonably complex.
Have a look at the project files in the zip archive here.
Item Values
In DVDSP the items that you create when authoring your project, such as tracks and menus, all have an in-built numerical value. This can be useful if you are trying to create a framework for a project that will use different assets each time you use it. Using the values helps you keep scripts pointing at the right asset and end jumps relevant, even when you replace the tracks, etc. It isn’t foolproof, but it can be useful.
The tutorial page helps explain how the item values can be ‘seen’ using a combination of scripts and then it is up to you how you use the information.
