I am trying to modify an already well running experiment in psycopy builder. The purpose is to save time by not running the rest of the trials after two inaccurate responses.
As you can see it has got three loops; ‘trials_2’, ‘trials’, and ‘trials_4’. Each loop has its own condition file.
A condition file has about 10 trials (10 rows). A column of a condition file contains ‘corrAns’. I would like the program to not run the remaining of the trials(rows), if two consecutive responses by the participant are inaccurate. My code component at the moment looks like this.
I had started the counter by stating ‘score=0’ at Begin Experiment of the code component.
if mouse_10.isPressedIn(image_20): continueRoutine = False # trial will run again thisExp.addData('repeat', 'yes') else : thisExp.addData('repeat', 'no') for stimulus in [image_21, image_24]: # check if the mouse is pressed within the current one: if mouse_10.isPressedIn(stimulus): # Yes, so store the reaction time in the data: thisExp.addData('RT', t) # check if the stimulus' image filename matches the correct answer: if stimulus.image == eval(corrAns): thisExp.addData('score', 1) score = score + 1 else: thisExp.addData('score', 0) # end the trial once done here: continueRoutine = False trials_5.finished = True break
I think this can be dome pretty easily but I have little success with my tries so far.
Any help is appreciated