|Page (2) of 4 - 10/19/04||email article||print page|
DVD Studio Pro Scripting, Part 3Adding a timer to an interactive quiz Setting the timer
So there are essentially two functions involved here. One is to get the timer started from zero; the second is to check the timer. If you recall from last week, we set started off the quiz with a splash screen that gives the user instructions. This screen contained one button, connected to a script called "Start Quiz," which sets our base GPRM values and jumps us into the first question. To this we need to add two commands in order to get our timer started.
First, we need to set the timer to 0. The timer, of course, starts at 0, but we want to put this command in anyway in case the user fails the quiz and wants to try it again. Without setting the timer to 0 as a part of the script, it would just keep counting up, and the user would have to eject the disc to reset it. So, to do this, we open up the base Start Quiz script and add a new command to the beginning. (Create the command and then just drag it up to the top.)
Open up the Script Inspector (View > Show Inspector, if it isn't already open). Select the new command, and then change it from "Nop" to "Set GPRM." We're going to use GPRM 2 for our timer, so that's the one we want to set to 0 to start things off. You do this by setting the Operation to "mov," the Source Type to "Immediate," the Source Value to "0" and the Target to "GPRM 2."
And then we need to get the timer started with its counting. We do this by adding a new command just below the command we just added. This new command will be "GPRM Mode." When you select this, you'll have two options: "Register" and "Counter." Select "Counter," and switch the Set To value to GPRM 2. By doing this, the number stored in GPRM 2 will increase by 1 every second until you tell it to do otherwise. So now the script for starting the timer is done, and here's what it looks like.
If you haven't done so already, now you'd connect this script to the button on the introductory splash page. When the user selects this button, it will reset all the relevant GPRMs, start the timer and forward him or her to the first question.
Related Keywords:apple dvd studio pro, scripting, timer, quiz, score
To Comment on This Article, Click HERE
Most Recent Reader Comments:
Click Here To Read All Posts
Must be Registered to Respond (Free Registration!!!, CLICK HERE)
Source:Digital Media Online. All Rights Reserved