|Page (3) of 4 - 10/12/04||email article||print page|
DVD Studio Pro Scripting, Part 2Creating a score counter for interactive quizzes Script 2: Correct
Our second script is a little more involved, but no more difficult. It will be used for the correct answers in our quiz. And it needs to do three things: add one to the score, add one to the question counter and decide where to go from there after the user chooses the correct answer. Where it needs to decide to go is either the next question or one of the final result screens, depending on the score. (The particular method described below is efficient in some ways, in that it allows us to use just one script for all of the buttons corresponding to correct answers; but it's also a little bit clumsy. See if you can figure out why. At any rate, it gets the job done!)
To begin, we need to add 1 to each of the GPRMs that we're using. We add 1 to GPRM 3 to add to the user's score, since this script is used for a correct answer. And we need to add 1 to GPRM 4 so that the script will know which question to jump to next. These first two commands use the "Set GPRM" command. But instead of using the "mov" operation, as we did in the previous script, we'll be using the "add" operation, which literally adds the number we choose to the base value set in the previous script. And the effects will be cumulative over the course of the quiz. Here's what these first two commands look like.
Next we want to use the script to determine whether we have a winner. For this script, the quiz will jump to the "Winner" menu as soon as the score reaches 4. So we'll use the Jump command and set the target to the menu called Winner. But we also need to do some checking to make sure that we do indeed have a winner. To do this checking, select the "Compare Command" checkbox. And set the values as follows.
These tell the program to jump to the Winner menu only if the score (as represented by GPRM 3) has reached 4 or higher. If it hasn't yet reached that number, this line will be ignored, and the next line will be read.
Related Keywords:apple dvd studio pro, dvdsp, scripting, interactive, quiz, game
Source:Digital Media Online. All Rights Reserved