>Date: Tue, 29 May 2001 17:47:01
 >From: "Gavin Sim" <[EMAIL PROTECTED]>
 >Subject: <lingo-l> Re: making  a quiz

 >can anyone andvise me how to make a multiple choice quiz with 5 questions
 >and three possible answers? The quiz needs to be scored and the person would
 >get two points for a correct answer and loose a point if they get it wrong?

 >can anyone Please help
 >thanks
 >gav

Gav,
Please see the question behavior below for one possible solution.

The behavior assumes field/text members for the answers:
- the answers use COPY ink
- the answers start in channel 8.
- all the correct answers are in consecutive channels in the score:
I find this also makes it easier to visually confirm correct answer sprites
in the score (when all correct answers have the same colour) - you can
mix the order of the answers on the stage itself.

For the purpose of demonstrating this method to you, this behavior simply 
outputs
the question score, after each mouseUp, to the message window -
In my CBT work I maintain a "tracker" sprite which becomes the repository 
of the
question scores and other outcomes I wish to track in the quiz.

property pScore, pFirstAnswer, pLastAnswer, pLastCorrect
property pRightValue, pWrongValue
on mouseUp me
   if sprite(me.spriteNum).ink = 0 then
     sprite(me.spriteNum).ink = 4
     if me.spriteNum <= pLastCorrect then
       pScore = pRightValue
     else
       pScore = pWrongValue
     end if
   else
     sprite(me.spriteNum).ink = 0
     pScore = 0
   end if
   calculateScore
end
on beginSprite me
   pScore = 0
end
on calculateScore me
   qScore = 0
   repeat with i = pFirstAnswer to pLastAnswer
     qScore = qScore + sprite(i).pScore
   end repeat
   put "Score:"&& qScore
end
on getPropertyDescriptionList
   set p_list = [:]
   addProp p_list, #pFirstAnswer, [#format : #integer, #comment : 
"SpriteNum of first answer:", #default : 8,#range:[min:8,max:20]]
   addProp p_list, #pLastCorrect, [#format : #integer, #comment : 
"SpriteNum of last correct answer:", #default : 10,#range:[min:8,max:20]]
   addProp p_list, #pLastAnswer, [#format : #integer, #comment : "SpriteNum 
of last answer:", #default : 12,#range:[min:8,max:20]]
   addProp p_list, #pRightValue, [#format : #integer, #comment : "Score for 
right answer:", #default : 2,#range:[min:1,max:10]]
   addProp p_list, #pWrongValue, [#format : #integer, #comment : "Score for 
wrong answer:", #default : -1,#range:[min:-5,max:0]]
   return p_list
end

Tony


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to