Tutorial: Page (3) of 4 - 10/19/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 3

Adding 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.

Page: Prev Page 1 2 3 4 Next Page

Related Keywords:apple dvd studio pro, scripting, timer, quiz, score

To Comment on This Article, Click HERE

Most Recent Reader Comments:
  • Re: DVD Studio Pro Scripting, Part 3 by Bruce Colgate at Oct. 20, 2004 7:00 pm gmt (Rec'd 4)
  • Re: DVD Studio Pro Scripting, Part 3 by David Nagel at Oct. 20, 2004 6:24 pm gmt (Rec'd 3)
  • Re: DVD Studio Pro Scripting, Part 3 by Bruce Colgate at Oct. 20, 2004 6:12 pm gmt (Rec'd 3)
  • DVD Studio Pro Scripting, Part 3 by DMN Editorial at Oct. 19, 2004 4:37 pm gmt (Rec'd 4)

    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