How To Create Right and Wrong Answers for Checkboxes?

Hi There,

OK so it sounds like you have 2 shapes that are ‘clickable’ by the mouse. You will then see that the mouse component also saves a set of parameters that you define (the default parameter is ‘name’ which is whatever you have typed in the ‘name’ field of your shape).

Add a column to your conditions file called ‘corrAns’ then specify on each trial the name of the shape that could be clicked (for the correct answer).

To save the ‘correct’ answer, you then need a small code component (custom>code). In the ‘end routine tab’ use:

if mouse.clicked_name == corrAns:
    correct = 1
else:
    correct = 0
trials.addData('correct', correct)#add this variable to your data file
#substitute 'mouse' for the name of your mouse component
#substitute 'trials' for the name of your loop

You can see a similar technique outlined here for typed responses :slight_smile: https://www.youtube.com/watch?v=-Fto45M7bS0

Hope this helps,
Becca

1 Like