I am trying to create a task where participants must decide if simple sentences are true or false. They do this in a practice round and are checked for accuracy before they either move on if they performed perfectly, or are forced to repeat the practice if they did not. I have created separate instructions and trials routines, and have used a loop inside a loop for the task, but no matter what the task seems to show the failure screen then repeat. I was hoping for some help making it skip the outer loop and routines in it if participants perform perfectly. Thanks!
I think .nTotal represents the total number of trials a loop will run (based on PsychoPy’s docs). Your Accuracy_repeat line 5 (if number_correct/(PM_Practice_loop.nTotal+1) >= 1.0:), might always be false because of the +1. I would try removing that +1 and see if it makes a difference.
This won’t solve the behaviour, but you could add print statements to narrow down where the problem is, for example:
if PM_practice_response.corr:
number_correct = number_correct + 1
print(f'Num correct: {number_correct}') # is accuracy recording correctly?
if PM_Practice_loop.thisN +1 == PM_Practice_loop.nTotal:
print("Finished a practice loop") # are thisN and nTotal matching when expected?
if number_correct/(PM_Practice_loop.nTotal) >= 1.0:
Accuracy_Check_Loop.finished = True
print("Got the practice right") # are number_correct and nTotal matching when expected?
To skip PM_Practice_Failure, you would need a code component within that routine which sets continueRoutine=False if your Accuracy_Check_Loop is ending.