I am creating a task in which three similar shapes (e.g. squares; S1, S2, S3) with different sizes are presented on the screen in each trial and participants have to order them from the smallest to the largest one.
I want to use a mouse component to collect the responses - every time that the participant clicks on a shape, I want to record the name of the shape on which the mouse has been pressed. At the end of the trial I want a response column with (S*, S*, S*) and I want to check if it matches my “corrAns” column.
I managed to write the code component to some extent, but for each trial it saves only the last shape I click on instead of all of them. The mouse is set to collect mouse state “on click”. I am not very familiar with coding… Does anyone know what is wrong in my code and how I can collect information for all the three clicks?
mouse.clickSequence =  squares = [S1, S2, S3]
for square in [S1, S2, S3]: if mouse.isPressedIn(square): mouse.clickSequence.append(square.name) thisExp.addData('clickSequence', square.name)
if mouse.clickSequence == eval(corrAns): thisExp.addData('correct_trials', 1) else: thisExp.addData('correct_trials', 0)