I want to skip a trial based on certain conditions while the loop is running. I tried using continueRoutine = False. But it is still recording an empty response. I do not want this because after each trial, in the end routine section it checks whether the response is different than the correct response and if incorrect or a trial was missed then the repeatCounter for that condition increases. But in this case, even when the trial needs to be skipped because no repitition is needed, the response is still recorded as a missed trial and that increases the repeat counter. #Begin routine
There is a small correction in the end routine, if skipFlag == 1, then the repeatCounter should reduce by 1 owing to the fact that it is being recorded as a missed trial and hence increasing the repoeatCounter, so it needs to be balanced
I’m sorry, I did not understand what changes in routine settings I should do. And yes, I meant to type end routine… It was a mistake… The end experiment code is in end routine section
If you put your Begin Routine code in a previous routine then you could set skipRoutine=True instead of comtineRoutine=False. Then add skipRoutine to the skip if field in your routine’s routine settings (cog in top left of routine)
Thanks, for suggesting a solution. I tried this solution however, still the empty responses are being recorded. Isnt there a simpler solution to this? I am fairly new to python coding and splitting some part of the code and putting it in a new routine is making me a bit confused.
You will get empty rows of you skip routines during a loop. Are you skipping rows based on randomisation rules, and nothing to do with your participant responses. If so, then it would be better to set up your trials list before the loop starts. Have a look at my complex randomisation online demo. Basically, you set up the list of row numbers you want to present and then set the loop to sequential with that list as selected rows.