AE ... the devil at work!

Workarounds and usability notes.

AE ... the devil at work!

Postby Robert Stevenson » Tue Feb 17, 2015 1:58 pm

I have a number of true/false question objects (which came right out of the box) in a randomized quiz. Regardless of the choice the student makes the following AE code rewards them with a mark. This only happens on this question. If someone could sort out where the evil is below I'd be much obliged.

--------------------------------------------------------------------------------
Actions for Group "(unnamed)" of Page "New Page50"
--------------------------------------------------------------------------------

-- On question answered... -----------------------------------------------------
Define local variable "currentquestionscore" (Initial value: 0)

Score Self
If currentquestionscore > 0
Set student_score to student_score + 1
Set text of Field "scorebox" of This Background to student_score
Else if currentquestionscore <= 0
Set student_score to student_score - 1
Set text of Field "scorebox" of This Background to student_score
End if



--------------------------------------------------------------------------------
Actions for Field "scorebox" of Background id 0
--------------------------------------------------------------------------------

-- On load page... -------------------------------------------------------------
Set text of Self to student_score
Robert Stevenson
 
Posts: 138
Joined: Wed May 14, 2014 11:46 am

Re: AE ... the devil at work!

Postby Clifton » Tue Feb 17, 2015 8:51 pm

on question answered has the parameter called score.
The value of score is either "incorrect" or "correct" and never resolves to a numeric value.

How are you getting a numeric value in your code? How does your code ever set the variable currentquestionscore, especially if this variable is a local variable.

Code should be something like:

    If score = "correct" then
      Set student_score to student_score + 1
    else
      Set student_score to student_score - 1
    end if
I assume the variable student_score is global, which is what it should be.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: AE ... the devil at work!

Postby Robert Stevenson » Tue Feb 17, 2015 10:28 pm

Thank you for taking care of the devil! Problem solved. The bizarre thing is that the posted code with currentquestionscore worked for all but this one true/false question. How I'm afraid I have no idea.
Robert Stevenson
 
Posts: 138
Joined: Wed May 14, 2014 11:46 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron