I am having problems in skipping a routine and getting to the end of the experiment. I am using version 1.85.3.
This the structure of my experiment:
Instructions 1 - with images
Test 1
Instructions 2 - again with the same images as Instructions 1
Test 2
End of experiment
If you don´t pass Test 1, the experiment should skip immediately to End of experiment.
This is working, but only roughly. If a participant fails Test 1 then the experiment goes to End. However, when I open the .csv file with the results, I can see in there that one instance of Instruction 2 has been executed (or loaded) and also one instance of Test 2. The file is to give you an idea: _Mental_Tr_2019_Dec_03_1357.csv (8.7 KB)
The second “same/Slide_A_1.jpg” and the trial after that, in the .csv file, should not be there. What can be causing this?
Focusing only on Instructions 2, this is how the loop looks like:
if not_eligible1 == 1: #if the participant is not eligible for Test 2 a value of 1 is assigned to the participant
repeat_training_loop_b.finished = True
continueRoutine = False
This is the code in instructions_b where the image of the instruction is loaded and shown:
if not_eligible1 == 1: #same as above
trials_b.finished = True
repeat_training_sub.finished = True
continueRoutine = False
Data is being recorded because the next iteration of the loop has actually started, even though you are immediately terminating it.
If you want to avoid this, you could put the check of whether to terminate the loop in the “end routine” code of the final routine, rather than the “begin routine” code of the first routine. That way, the next iteration doesn’t actually commence.
Dear Micheal, thanks for the reply. I think that the problem is slightly different. When you say next iteration, I actually mean first iteration.
Let me explain, it is not that I don´t want the repeat_training_loop_b to repeat, I don´t want it to start in the case in which the participant is not elegible. If I put the “finishing loop” code at the End Routine of the final routine, one loop has to be executed to reach the End Routine.
This is weird to me, it seems that I am killing the loop immediately but something is loading.
Maybe I can add some coding details I forgot to mention in the first message:
The code for teriminating repeat_training_loop_b is in Each Frame of pre_instructions_b
if not_eligible1 == 1:
repeat_training_loop_b.finished = True
continueRoutine = False
The code for terminating the trials_b loop is in Each Frame code of instructions_b
if not_eligible1 == 1:
trials_b.finished = True
continueRoutine = False
Finally, to terminate repeat_training_sub code is in Each Frame of feedback_training_b
if not_eligible1 == 1:
repeat_training_sub.finished = True
continueRoutine = False
Also to be a little bit clearer, these are the problems in the output file. Those in green are things that are loaded but shouldn´t be.
And the structure of the experiment is as such:
Instructions 1 => Test 1 => Results => Instructions 2 => Test 2 => End
Where Instructions 2 and Test 2 are only shown if the results in Results are good.
OK, sorry I didn’t pay careful enough attention to your initial post. What you could try doing is give the nReps field for the loop a variable name rather than a literal value (say, training_loop_reps). Then in the eligible_t1 routine, have a code component that sets that variable to 0 if you don’t want the loop to even start:
if not_eligible1 == 1:
training_loop_reps = 0
else:
training_loop_reps = 1 # or whatever value is appropriate