Setting the value for the correct var according to cursor_roi [Cats, dogs, and capybaras Tutorial]
Hi
I am implementing the "Cats, dogs, and capybaras" task (https://osdoc.cogsci.nl/3.2/tutorials/capybara/).
I would like to define the correct variable, according to whether or not the click was on the correct region of interest. So, I am using an inline script at the beginning of the trial sequence (I also tried to move it after the mouse response item):
if var.cursor_roi == var.animal:
var.correct = 1
else:
var.correct = 0
I am getting the following error message: "The variable 'cursor_roi' does not exist. Tip: Use the variable inspector (Ctrl+I) to see all variables."
I already used the cursor_roi variable in the feedback item (show if: [cursor_roi]=[animal]), and everything works fine.
What am I doing wrong with the script?
Thank you for your time,
Fotis
(The .osexp file is here: https://www.dropbox.com/s/92umal0l6c1uqv2/Multi_script.osexp?dl=0)

Comments
Hi @fotisfotiadis
This is because you have placed your code in the prepare phase, while response related code belongs in the run phase. Your code is now executed during the preparation stage of the trial, and thus before a response has even been collected. You can read more about the prepare/run dichotomy at https://osdoc.cogsci.nl/3.2/manual/prepare-run/
Yes, that fixed it. Thank you for your response.