Skip routines inside a loop based on a slider response (online)

Hi everyone!

I’m having trouble with something that has been raised before in this forum but I was unable to solve the issue in my specific case.

I have a loop with 3 routines: the first routine has a slider response (which seems to be stored as slider.response in my csv data) and two following routines have questions that only make sense if the participant has given a response rating of over three (on a slider with 5 ticks: 1,2,3,4,5 and labels on the screen). Therefore, I’d like to have those two routines be skipped every time the participant gives a rating of 1 or 2 (less than 3), and the next iteration to start. The loop includes 9 iterations based on another file with my stimuli.

I have tried including the following code components in the “each frame” tab of those two routines (people have said that it doesn’t work online in “Begin Routine”):

if slider.response < 3 : 
continueRoutine = False

But this doesn’t seem to work: my experiment runs smoothly online, but the routines aren’t skipped if the slider response is under 3.

I’ve tried changing the code type from Auto > JS to Py, which doesn’t seem to work.

Is there something I’m missing here ?

All the best,

Cameron

Likert_only_online.psyexp (54.5 KB)

Hey I just found a solution to my problem !

I just had to store the response in a variable at the end of the first routine and then apply the if condition to that variable in the 2nd and 3rd routine.

I kept it in the EachFrame tab but toggled Auto > JS.

Would you mind sharing the code you used to store the slide response? I am attempting to do the very same thing and haven’t quite figured out the storage piece. Thanks!