Tutorial: Page (2) of 4 - 10/12/04 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook

DVD Studio Pro Scripting, Part 2

Creating a score counter for interactive quizzes
The scripts
Once you have your menus designed, the rest is all scripting. And in this case, scripting is going to save us a tremendous amount of manual labor in the construction of this quiz. In order for this to work, we need to design three scripts, which I'll detail below. Please follow along as you're reading this. It sounds more complicated than it is, and if you have your script palette open as you work through this, you'll see that it's really not difficult at all.

To set this up, create three new scripts (Project > Add to Project > Script). Name them "Start Quiz," "Correct" and "Incorrect," respectively.

Script 1: Start Quiz
We'll begin with the script that kicks off our quiz. This script has two purposes: to reset the values of the GPRMs we'll be using and to lead us into the first question. And it consists of only three commands. Here's how it works.

First, our quiz is going to require the use of two GPRMs. One of these will keep track of the score, while the other will keep track of the questions, allowing us to go automatically to the "next question" rather than manually creating individual scripts for doing so. In this case, the two GPRMs I'm going to use are 3 and 4. These are arbitrary; I simply like to stay away from 0 and 1, and I have something else in mind for GPRM 2 in our next installment in this series.

Now, what does this mean that we're using GPRM 3 and GPRM 4? Think of these as storage bins for numbers. You have eight storage bins to choose from (GPRMs 0 through 7). What we're going to do with them is to throw some numbers in, and then have our scripts make some decisions for us based on what those numbers add up to. So first we're going to give them some starting values in this initial script. We'll then use the other two scripts to add to these starting values to achieve our goals.

By default, each script starts will a "Nop" command, which basically does nothing. Select this command in the script window. Then, in the Script Inspector palette, chance the command to "Set GPRM." Set the Source Type to "Immediate," the Value to "0" and the Target to GPRM 3. This is the GPRM we'll use to keep track of the score, starting at a base value of 0.

Now click the little plus sign in the Script window to add a second command. This one will be almost identical to the first, except that we'll be using GPRM 4 and setting its value to 1. The reason I'm setting it to 1 instead of 0 is simply to help me keep track of things. This GPRM will be used to determine which question comes next in order. With a value of 1, it will go to question 1; with a value of 2, it will go to question 2; etc. This will become clear in the next script.

And, for our final command, we'll add in a jump to the first question in the quiz--in this case, my menu called "Question 1." Here's what it looks like.

And now our first script is done. This script will then be attached to the "PLAY IT NOW" button in the introductory splash screen. You can do this simply by dragging the script from the Outline tab onto that button ion your menu viewer.

Page: Prev Page 1 2 3 4 Next Page

Related Keywords:apple dvd studio pro, dvdsp, scripting, interactive, quiz, game

To Comment on This Article, Click HERE

Most Recent Reader Comments:
  • DVD Studio Pro Scripting, Part 2 by DMN Editorial at Oct. 12, 2004 11:55 am gmt (Rec'd 5)

    Click Here To Read All Posts
    Must be Registered to Respond (Free Registration!!!, CLICK HERE)
  • [ServletException in:/common/ads/links.jsp] The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application'

    Our Privacy Policy --- @ Copyright, 2015 Digital Media Online, All Rights Reserved