If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win11
PsychoPy version (e.g. 1.84.x): 2023.2.1
Standard Standalone? (y/n) Y
I have built most of my experiment; the last thing I need to do is write a code so that based on participant number, every other cycle the participant either restudies the images or takes a practice test. I have a loop around my restudy routine, trials_4, and two practice test routines, which are surrounded by loop trials_5 (with an inner loop around one of these routines called trials_6). I have tried placing the following code in a routine right before these three routines, but as soon as the experiment gets to this routine it is becoming unresponsive and I have to end task. Is there anything obviously wrong with this code that would be causing this? It may be a terrible attempt at what I am trying to accomplish (I am very new to this)–this was a first try; I have not even yet been able to try to debug the code as I am not getting an error code…:
# Get participant number from user input or other method
participant_number = int(input("Enter participant number: "))
# Determine whether to start with restudy or practice test based on participant number
start_with_restudy = participant_number % 2 == 0
start_with_retrieval = participant_number % 2 == 1
current_cycle_indexP = int(trials_3.thisN)
# Begin Routine
if start_with_restudy:
if current_cycle_indexP % 2 == 0:
trials_5.setAutoDraw(False)
trials_6.setAutoDraw(False)
trials_4.setAutoDraw(True)
else:
trials_4.setAutoDraw(False)
trials_5.setAutoDraw(True)
trials_6.setAutoDraw(True)
if start_with_retrieval:
if current_cycle_indexP % 2 == 0:
trials_4.setAutoDraw(False)
trials_5.setAutoDraw(True)
trials_6.setAutoDraw(True)
else:
trials_5.setAutoDraw(False)
trials_6.setAutoDraw(False)
trials_4.setAutoDraw(True)