10 Replies Latest reply on Sep 16, 2009 11:52 AM by jrwhitesel

    Scoring for a simple quiz

    jrwhitesel

      Been doing some searching and trying to find out how to do some simple scoring on a simple quiz.

       

      Anyone have any idea of how I would go about creating a score system to give a % result on a simple quiz?

       

      Thanks

       

      Jodie

        • 1. Re: Scoring for a simple quiz
          Sean_Wilson Adobe Community Professional

          Try searching for quizzes on DOUG and then ask a specific question if you're still having trouble.

          • 2. Re: Scoring for a simple quiz
            jrwhitesel Level 1

            I didn't seem to find what I was looking for to work with the simple quiz I read through the other tests and tried to modify it to work with what I'm doing.

             

            For each question page they answer what the photo is with a button with the name of the two choices.

             

            Do I out this on the correct questions with the correct buttons named  mound, yes, and ridge

             

            case sprite(spriteNum).member.name of
            "mound", "yes", "ridge" : -- etc
            QResult = QResult + 1
            end case

             

            QPercent = (QResult * 100) / 3
            put QPercent "this is the percent "
            go next
            end

             

             

             

             

            What do I do to add a core at the end??

             

            Am I doing this right or on the right track??

             

            Thanks

             

            Jodie

            • 3. Re: Scoring for a simple quiz
              Sean_Wilson Adobe Community Professional
              For each question page they answer what the photo is with a button with the name of the two choices.

              Do I out this on the correct questions with the correct buttons named  mound, yes, and ridge

              You say "two choices" then cite three - when you want help you should start by confusing those who would provide it!

               

              Is your variable "QResult" declared as global? You might need to be using floating point numbers:

              QPercent = integer((QResult * 100.0) / 3)
              put QPercent "this is the percent "

              You ask:

              Do I out this on the correct questions with the correct buttons named  mound, yes, and ridge

               

              case sprite(spriteNum).member.name of
              "mound", "yes", "ridge" : -- etc
              QResult = QResult + 1
              end case

              but no-one here has enough information to sensibly answer that for you. If this code runs in response to a mouse handler (like #mouseUp, for example), AND clicking a sprite whose member name is "mound", "yes" or "ridge" qualifies as a correct answer for this particular question, then I would answer yes to your question, but you haven't provided any context.

               

              What do I do to add a [s?]core at the end??

              You already have a put statement:

              put QPercent "this is the percent "

              What I suspect you need to do is place this in a #text member that has a sprite on-screen at the end of your quiz so that your user can see what they scored.

              member("results").text = "You scored:" && QPercent
              1 person found this helpful
              • 4. Re: Scoring for a simple quiz
                jrwhitesel Level 1

                Guess I don't understand this all too well...

                 

                 

                Lets try to make this simle so I can try to grasp this better.

                 

                I have 2 questions on seperate pages with a right and wrong answer button for each question.

                 

                 

                What lingo script do I put on the right Sprit button?

                 

                 

                On the end page to show the score, how do I make the score show up?

                 

                 

                I tried different things and it just gave me errors.  Is there an example of this somewhere, I guess I don't understannd how and where the code goes.

                 

                Here's a simple Director file so you can see what I have, I took out the lingo since it just made errors when saving.

                 

                Thanks

                • 5. Re: Scoring for a simple quiz
                  Sean_Wilson Adobe Community Professional

                  Here is your example file back. I deleted the BG image in an effort to save some file size. I also replaced all your individual "_movie.go()" scripts with a single behavior that can be reused. Hopefully it's self-explanatory how it's put together and works, but ask again if you don't understand.

                  • 6. Re: Scoring for a simple quiz
                    jrwhitesel Level 1

                    Ahhh I think I understand it better, if I wanted to have 2 sperate quizes in one movie with 2 seperate score results on a single page, would I just keep the lingo the same but change the names of the sprites for the copies...or would I have to include more lingo in the existing scrtipts?

                     

                    Thanks so much for the help!!  I'm understanding it a lot better.

                    • 7. Re: Scoring for a simple quiz
                      Sean_Wilson Adobe Community Professional
                      if I wanted to have 2 sperate quizes in one movie with 2 seperate score results on a single page, would I just keep the lingo the same but change the names of the sprites for the copies...or would I have to include more lingo in the existing scrtipts?

                      No, it wouldn't work out-of-the-box. For the sake of simplicity I created a couple of global variables (gnQuestionCount and gnCorrectResponses). If you try to create 2 quizzes you need to maintain separate variables for each quiz. Also the "question count", "correct answer" and "display results" scripts would need to be altered/duplicated to reference these separate quizzes.

                       

                      Why did you not explain this requirement earlier, especially as you were wanting someone else to write code for you?

                      • 8. Re: Scoring for a simple quiz
                        jrwhitesel Level 1

                        Ahh ok, Just trying to learn the basics of how the scoring concept works and try to learn more and expand the idea as I understand it a bit more.

                        I'll try the idea of making a new set of lingo scripts and alter them.  Should they be changed to something liek this with an added B for test B on all the scripts?

                         

                        global gnQuestionBCount
                        global gnCorrectBResponses

                         

                        property spriteNum

                         

                        on beginSprite me
                          sprite(spriteNum).member.text = string(integer((gnCorrectBResponses * 100.0)/gnQuestionBCount)) & "%"
                        end

                         

                         

                         

                        Thanks

                        • 9. Re: Scoring for a simple quiz
                          Sean_Wilson Adobe Community Professional

                          jI'll try the idea of making a new set of lingo scripts and alter them.  Should they be changed to something liek this with an added B for test B on all the scripts?

                           

                          global gnQuestionBCount
                          global gnCorrectBResponses

                           

                          property spriteNum

                           

                          on beginSprite me
                            sprite(spriteNum).member.text = string(integer((gnCorrectBResponses * 100.0)/gnQuestionBCount)) & "%"
                          end

                          Yes, that should work. Another option might be to maintain a single global list which itself contains individual (property) lists for each separate quiz, and doing so might make your code more readily reused - but there's nothing wrong with learning to walk first.

                          1 person found this helpful
                          • 10. Re: Scoring for a simple quiz
                            jrwhitesel Level 1

                            Thanks for the suggestion, all seems well with adding a second quiz to the move, few problems I run into.

                             

                            If they go to the final score page without taking both test, I get a divide by Zero error

                             

                            Also, if they go back to the main menu that lists the tests and take the test again, it changes their percentage score.

                             

                            Not sure what do do with that, is there a way to make the score only count once or block them from going to that test again or mot seeing the final score until they have taken all the tests?

                             

                            Thanks for the help on this, seems like a little simple thing starts turning into more once you start playing with it and coming across bugs

                             

                             

                             

                             

                            I