did you set the granularity of the slider to 1 (integer). The default is 0 or continuous. So your code might simply fail because the rating is never 2 but, for instance 1.999 or 2.001.
The following code skips the second routine (in the same loop). You might need to adopt the names:
if slider.rating == 2:
continueRoutine = False
This assumes that you slider is named slider. This code is in a code-component of a routine directly following the routine with the slider. The code-component is in the top row and the code is in the Begin routine tab.
Thank you for taking time to answer my questions.I really appreciate your help!
Yes, I have set the granularity of the slider to 1. And the slider is named as ans1.
I’m not sure if I successfully assign the slider-answer to ans1.response. Is it enough to write the following?:
ans1.response=()
I did this because there is a column in the outcome file named ans1.response.
Sorry! I just figured out how to upload the screenshots.
Which routine do you want to end? If you want to end routine2 you need to put that code that evaluates the slider-response in the Begin routine tab of routine2. The slider ans1 is, I assume, in routine.
Notice that there is probably no need to assign the slider-response ans1 to a variable. You can access it directly with ans1.rating. So change your code to
if ans1.rating == 2:
continueRoutine = False
trials_que.finished = True
BTW, try to use names for your routines that make more sense than routine and routine2