Cannot use Multiple Choice Response Variable in Inline-Script
I am creating a simple Personality-Test, with 10 multiple choice questions and, based on the participants answers, calculate their scores for the BIG5 traits. Therefore I want to use the response variable (lets say response_question1) in an inline script and set a new variable to numbers btw 1-5, depending on the value for response_question1.
The problem is that when I want to use the response variable in an inline-script, i get the following error "Name Error: name "response_question1 is not defined", even tough I can see it in the variable inspector.
Is there some special syntax which I need to use to access the variable in my inlince script?
Thanks
Jean
Comments
Hi Jean,
Did you use the `var` object to refer to your variable in the `inline_script` item?
Like so:
print var.response_question1
See also:
https://osdoc.cogsci.nl/3.2/manual/variables/#using-variables-in-python
Also, did you place the code in the `prepare` tab or in the `run` tab of your `inline_script` item?
Cheers,
Lotje
Did you like my answer? Feel free to
