Hello! I am brand new to psychopy and trying to a build a conditional loop into my experiment, that will only enable subjects to continue to the main block of the experiment after correctly completing 3/5 of the practice trials. In the experiment, participants must press a specified key (z or m) as soon as they see a bad stimuli, and press the other specified key (z or m) as soon as they see a good stimuli. I want my code to restart the practice loop until they correctly complete 3/5 trials, which will then take them to the main block of the experiment. The problem I am facing is that the designation of the button presses (press z for good or press z for bad) is randomized using the following code component, so I can’t figure out how to indicate which key is “correct” in order to create a score to either prevent or enable participants from moving on. I’m not sure if that makes sense, but I would really appreciate any, and all help!
keycondition=random() if keycondition>0.5: thisExp.addData('keytext',"mgood_zbad") else: thisExp.addData('keytext',"zgood_mbad") if keycondition>0.5: thisExp.addData('corpracbad',"z") else: thisExp.addData('corpracbad',"m")