3 Replies Latest reply on May 14, 2012 5:52 AM by josh_chunick

    Name / Score / Results

    Costas_B

      On the educational software i'm creating it is important to know the student who is taking the test and also track the score of the students. The software will have 4 sections with 10 or more chapters in each section.

       

      How can i add the name of the student and keep it till the end? For example: at the beggining of the application to prompt the user to fill his/her name.

       

      How can i track the score in each section and have a result page with all the scores from the 4 sections?

       

      Thank you in advance for any help.

       

      Costas--

        • 1. Re: Name / Score / Results
          josh_chunick

          Use a Parent script and initialize an instance of it using a global variable. If the sections/chapters are not going to be completed concurrently during any given session then you'll need to save the information which can be done a number of ways depending on if this will be online or offline (on a client computer).

          • 2. Re: Name / Score / Results
            Costas_B Level 1

            Thank you for your answer. It will be offline.

             

            Could you please give me any examples of the above? Thanks in advance.

            • 3. Re: Name / Score / Results
              josh_chunick Level 1

              After reading your other posts I think a simpler solution is in order. Use a global variable to keep track of scores. If you need to have a score for each section then make 4 global variables. For example:

               

              -- in a moviescript

              global gScoreSection1

              global gScoreSection2

              global gScoreSection3

              global gScoreSection4

               

              on startMovie

                gScoreSection1 = 0

                gScoreSection2 = 0

                gScoreSection3 = 0

                gScoreSection4 = 0

              end startMovie

              -- end of moviescript

               

              then, wherever your code is to add to the score for a correct answer you simply do this:

              gScoreSection1 = gScoreSection1 + 1

               

              you'll need to keep track of what sections you are in so however you are doing that just change to the appropriate global variable.

              Note: make sure that in each script member where you're using the global variable that you declare it at the top of the script just as in the moviescript example above, ie:

              -- in any script you use that global variable

              global gScoreSection1

               

              on someHandler me

              -- some code here

              gScoreSection1 = gScoreSection1 + 1

              end someHandler

              -- end script

               

              otherwise, if you don't declare it at the top of the script you will get an error stating something like, "Script error: Variable used before assigned a value"