|Page (3) of 4 - 10/19/04||email article||print page|
DVD Studio Pro Scripting, Part 3Adding a timer to an interactive quiz Checking the time when a button is selected
The second function we need to address is checking the time and taking the appropriate action based on that time: either to continue with the quiz or tell the user that time is up. To do this, we need to modify our existing scripts that we've attached to our answer buttons and the question menus. These buttons, as you'll recall, keep track of which question we're on and what the user's current score is. To this functionality we'll add a check for the time, determine whether time is up and then redirect the user to the Loser page if the time is indeed up.
This is accomplished by adding a single command to the existing answer scripts (which are called "Correct" and "Incorrect"). Here's how it works.
First, add a blank command to the existing script. In my example, I'll put it in third position before all of the other Jump commands. (If we put it after the other commands, it wouldn't work because the conditions for the other jumps would be met first, and then the script would never get to the timer check.)
Like the other commands, this one will be a Jump command, pointing to the Loser screen. But we don't want to send the user to the Loser screen unless time has run out, so we need to set it to check the time. Do this by selecting the Compare Command function. And tell it to execute if GPRM 2 is greater than or equal to (">=") the immediate value of 60. This will give the user 60 seconds to answer all of the questions. Of course, you don't have to use 60 seconds; you can set this value to anything you think is appropriate.
Then simply repeat this command in the "Incorrect" script as well. You then attach thee scripts to your answer buttons, and anytime one is selected by the user, the script will check to see whether time has run out before moving on to the next question. Simple enough.
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