Repeat trial if no response/

Hello,

I need to repeat trials when participants don’t respond or respond with a key that isn’t allowed. My trials are in a spreadsheet in the Prac_Loop. And Control_Prac sends participants back to the start if they don’t reach 70% accuracy. Everything I’ve tried either crashes if there’s a wrong/ no response or doesn’t repeat the trial if it’s not an allowed response.
From the forum it seems like it could be because its a nested loop - but I need it to keep running until they get over 70 - so not sure how it would work without that. I also tried it on just a loop (not nested and it didn’t work). I’ve tried a few code snippets for example one being.
begin routine:
repeat_trial = True
repeat_count = 0
max_repeats = 1000

each frame - I have a slider which increases for how long the button is pressed.
if slider.getRating() is not None:
repeat_trial = False

End routine:
if repeat_trial:
repeat_count += 1
if repeat_count >= max_repeats:
print(“Trial repeated too many times. Moving on.”)
repeat_trial = False
else:
continueRoutine = False

This does nothing in End Routine.

How about having a loop around your trial called repeat_count with repetitions set to max_repeats. If there is a correct response you can move forward by setting repeat_count.finished = True.

Ah all fixed thank you so much (again)!!!

Thanks for the continued help.

I was wondering if you can do something similar in interleaved Quest staircases. Repeat the same trial if there is no valid response. I tried to implement it using a loop like the repeat_count but it takes me back to the startvals of my Quest (I have two staircases in my quest). Is there anyway of avoiding this?

I don’t work with staircases but repeat_count would be a normal loop inside your staircase loop.