Sequence of routines based on slider response

I’m sorry if someone already asked something like this anywhere. I couldn’t find an answer to my question if it is possible to determine the sequence of multiple routines based on a response that people gave on a slider component.
For example, if they choose option 1 I first want to present them Routine 1 and then Routine 2. If they choose option 2 on the slider I want to do it the other way round. Is this possible somehow?

I think it depends on how different your routines are. For example, if it is just a case of differing stimuli between routines, you can add a code component at the end of your routine where the slider is to determine which conditions file is used.

See here for info on blocking and counterbalancing (

Hey, I tried to follow the instructions but I am unable to click ok here.

Also, I think my experiment doesn’t quiet match the instruction for blocks and counterbalancing cause I don’t know from the beginning in which group/condition participants are. Is there another possibility with code components that are like
if sliderRating == 1, then present routine 1 and afterwards routine 2. else sliderRating ==2 present routine 2 first und then routine 1?

Hi There,

Apologies for my delayed response. This demo should do what you need :slight_smile: please note the ‘selectBranch’ code component in the ‘trial’ routine. Essentially we use the slider response to determine the conditions files used, and the conditions files determine the which routine will be presented on each iteration of the loop using nReps (0 will mean that routine is never presented)

sliderBranchedExp.psyexp (14.1 KB) conditionsA.xlsx (8.5 KB) conditionsB.xlsx (8.5 KB)

Hope this helps,

Hey Becca,
thank you so much. Unfortunately I can’t run the study.

Running: /Users/b/Desktop/

/Applications/ can’t open file ‘/Users/b/Desktop/’: [Errno 2] No such file or directory

also I can’t klick the code component to see what is written in there.

Weird - shouldn’t need a last run file. make sure all of the files are in a specific folder (rather than just on a desktop) - here is the latrun file from my directory nonetheless (18.7 KB)

In terms of clicking the code component - that is strange - please can you make sure you are running a recent version of psychopy (preferably 2020.2.6 as that is what I made this in Releases · psychopy/psychopy · GitHub)


Hi There,

To clarify - the branching works (and my demo illustrated how to do this ok for you?) but this is possibly a separate issue specifically relating to image presentation in your task and only when online?

Since this is a separate issue. Please can I request that you mark my answer above as the solution for this query, and start a separate thread for a new issue. But first, some debugging things to try

  1. does this run locally but not online? if so this is a JS error, so try opening the developer tools as outlined in the psychopy to JS crib sheet to see if you get an error message.
  2. if this doesn’t work locally, look in the ‘alerts’ box, this can have useful information that might help you figure out why the picture is not presenting (e.g. a small typo can mean the image is presented off the screen! but the alerts box will warn you of that).

once you’ve had a play with these do feel free to start a new thread, sharing error messages with us can also help us figure things out more quickly :slight_smile:


oops I see you marked the corresponding solution whilst I was responding! thanks!

I already asked that one in the “original” thread. Is that ok like this?

And yes, you got it right. It does work in the Builder but not online. But I don’t get any error message.

deleting and reuploading the project on pavlovia solved the problem.

Hi @bubu,

Pleased to see that you found the solution to your problem :slight_smile: