output variables not updated
Hi!
I'm running an experiment where participants have to answer certain test questions. If some of their answers are incorrect, the test is repeated. Everything works fine, but when at the end of the test I'm trying to output the proportion of the correct answers to the participant ("You have [proportion] correct answers"), it shows the value from the PREVIOUS loop run. After the first run it will always be 0, on the second run it will be the value from the run etc. Meanwhile, in the logfile the variable is logged correctly, and all the conditionals that use the variable work correctly.
The relevant pieces look like that:
inline_script: define variable "ncorrect", set to 0 through exp.set
sequence
loop (repeats the test; break if ncorrect is maximum, breaks when it must)
sequence
inline_script: set ncorrect to 0, update through exp.set
loop (the test itself)
sequence
form (participant answers the question)
inline_script: checks whether the answer is correct; updates ncorrect through exp.set
logger
sequence (test results)
inline_script: proportion = ncorrect/maximum, set proportion through exp.set
form_text_display: You have [proportion] correct answers (and it's here the number is wrong!)
OpenSesame version 3.2.7, backend legacy, all the inline_scripts are in the Run phase (I tried moving them to Prepare, but that doesn't help).
Tried searching the forum, but didn't find exactly the same problem.
Thanks!
Comments
Hi Sasha,
My first guess is that you're showing this feedback using a
sketchpad
, which is prepared in advance and thus does not reflect up-to-date variables. If so, then you'll want to use afeedback
item, which is not prepared in advance. Does that clear things up?See also:
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
ah, yes, that does solve it, thanks very much!
Best,
Sasha