Random Play Script in DVDSP3
by Vik on Sep 2, 2004 at 12:02:00 am
I'm having a problem creating a script in DVDSP3 on OSX. I need a script that plays random clips when the main menu times out. I have no problem creating a script that has the main menu time out, plays a clip and then returns to the main menu. It's having it do it again with another clip that is throwing me for a loop.
Ideally it would go:
Main menu times out, clip 1, main menu.
Main menu times out, clip 2, main menu.
Main menu times out, clip 3, main menu.
I'm sure it's an easy step, but I just can't seem to get it working. This is my last step for the DVD so I hope someone can help!
Re: Random Play Script in DVDSP3 by Hal MacLean on Sep 2, 2004 at 7:07:07 pm
Nice article - shows several ways to do a random playback, and the good part is that if this was available as a project the scripts would go right into DVDSP 3.
However, scripting a random playback in v3 can be easy or very complex, depending on how random you want it. For example, creating a script with a random number generator is easy:
ran GPRM 0, 4
will choose a number, at random, between 1 and 4 and place it into GPRM 0. The value can then be used:
Jump Track 1 if (GPRM 0 = 1)
Jump Track 2 if (GPRM 0 = 2)
Jump Track 3 if (GPRM 0 = 3)
Jump Track 4 if (GPRM 0 = 4)
The problem here is that the random generator could well generate the same number each time, so giving the appearance of it not being very random. There are several ways around this and simply increasing the number of possibilities can help... although it isn't guaranteed, of course.
The next thing to think about is whether or not it matters that the same film plays several times in succession - if not, then this is the script to use, but if you want to absolutely make sure that the playback is random AND that no clip or track will play twice until they have all played at least once, then you need a far more sophisticated script.
Fortunately, Alex Alexzander has already done a freely downloadable project that randomly plays up to ten tracks without a repeat, and it can be found at OSXWorld.com - if you download the project files you will see the scripting involved and can use this example to fit into your current project (version 2 or 3).