Announcement

Collapse
No announcement yet.

Making a Basic Quiz/Testing Application

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making a Basic Quiz/Testing Application

    AutoPlay Media Studio 5.0 Knowledge Base

    Making a Basic Quiz/Testing Application

    Document ID: IR10051
    The information in this article applies to:
    • AutoPlay Media Studio 5.0 Standard Edition
    • AutoPlay Media Studio 5.0 Professional Edition

    SUMMARY

    This article describes how to make a simple quiz.

    DISCUSSION

    As an example, we will create a two page test, and a third page to display the results:

    1. Create a project with three pages.

    2. Insert the following code in the Global Functions:

      --Each of the following tables contains a question, and 4 answers:
      Q_01 = {Question="How many legs does a three leg'd dog have?", A1="One", A2="Two", A3="Four", ACorrect="Three"};
      Q_02 = {Question="How many legs does a one leg'd cat have?", A1="Three", A2="Two", A3="Four", ACorrect="One"};
      Correct={Q1="",Q2=""};

    3. On Page1, create one paragraph object, and four button objects.

    4. In the On Preload event of Page1, insert the following code:

      Paragraph.SetText("Paragraph2", Q_01.Question);
      Button.SetText("Button1", Q_01.A2);
      Button.SetText("Button2", Q_01.A1);
      Button.SetText("Button3", Q_01.ACorrect);
      Button.SetText("Button4", Q_01.A3);

    5. Insert the following code into the On Click event of Button1:

      Correct.Q1 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    6. Insert the following code into the On Click event of Button2:

      Correct.Q1 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    7. Insert the following code into the On Click event of Button3:

      Correct.Q1 = "Correct";
      Page.Navigate(PAGE_NEXT);

    8. Insert the following code into the On Click event of Button4:

      Correct.Q1 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    9. On Page2, create one paragraph object, and four button objects.

    10. In the On Preload event of Page2, insert the following code:

      Paragraph.SetText("Paragraph2", Q_02.Question);
      Button.SetText("Button1", Q_02.A3);
      Button.SetText("Button2", Q_02.A2);
      Button.SetText("Button3", Q_02.A1);
      Button.SetText("Button4", Q_02.ACorrect);

    11. Insert the following code into the On Click event of Button1:

      Correct.Q2 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    12. Insert the following code into the On Click event of Button2:

      Correct.Q2 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    13. Insert the following code into the On Click event of Button3:

      Correct.Q2 = "InCorrect";
      Page.Navigate(PAGE_NEXT);

    14. Insert the following code into the On Click event of Button4:

      Correct.Q2 = "Correct";
      Page.Navigate(PAGE_NEXT);

    15. Create one paragraph object on the last page of your project.

    16. Insert the following code into the On Preload event of the last page:
      string_correct="";

      correct = 0;

      possible = 0;



      for j,k in Correct do

      possible = possible + 1;

      if k == "Correct" then

      correct = correct + 1;

      end

      end



      Paragraph.SetText("Paragraph2", "Question 1: " .. Correct.Q1 .. "\r\n" ..

      "Question 2: " .. Correct.Q2 .. "\r\n" ..

      "You answered correctly " .. correct .. " out of " .. possible ..

      " possible questions for a score of " .. ((correct/possible)*100) .. "%."

      );

    KEYWORDS: AutoPlay Media Studio 5.0, Quiz, Test, Multiple Choice


    Last reviewed: September 26, 2003
    Copyright © 2003 Indigo Rose Corporation. All rights reserved.

  • #2
    this doesn't work

    Comment


    • #3
      I'm pretty sure it does, what specific problem are you having?

      Comment


      • #4
        it works, you just need to tweek the code a little bit. Desomds code refers to paragraph2, but by default AMS will name a new paragraph object paragraph1

        So - you can either re-name your paragraphs, or change the code. :yes

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎