Counterbalancing on Pavlovia

URL of experiment: https://pavlovia.org/ab3082/dissertationpilot

Description of the problem:

I created this experiment in Builder. To counterbalance, I have 4 conditions files with different sets of stimuli and created an Experiment Info field called “Block” (I realize now I should have called it “group”) in Experiment Settings. This field shows up in the dialogue box in Builder.

When I run the experiment online, this field does not show up in the dialogue box. Only the “participant” and “session” boxes appear. It seems that four separate experiments were generated in the py -> js conversion. PilotExperiment.py, the experiment I made in Builder, shows up in the first folder, but there is no PilotExperiment.js in the html folder. Rather, there are four distinct experiments: PilotExperiment_Block1.js, PilotExperiment_Block2.js, and so on. I’m not sure whether that’s normal. The experiment url always takes you to PilotExperiment_Block1.

Ideally I could generate 4 separate urls to the 4 versions, but I would also be fine with participants entering a number 1-4 in a dialogue box online as in the Builder version. I realize this topic addresses a similar question. However, I don’t fully understand the explanation or how to apply it to my situation, or whether it’s really the same question. I’m very new to PsychoPy/Pavolvia and don’t have a coding background.

Thanks in advance for your help and patience!

Update: I’ve found a solution. Since the url was only taking me to one of the four experiments generated in the Py -> js translation, I edited the .js code for that one experiment so that the opening dialogue box now has a field for “block” and so that the value entered here specifies which conditions file is used. In case anyone is reading this for the same issue and is new to coding like me, here are the relevant lines I edited:

to add the field “block” to the dialogue box:
let expInfo = {‘participant’: ‘’, ‘session’: ‘001’, ‘block’: ‘’};

to make the conditions file that’s chosen match the block number entered in the dialogue box, in the portion of the study that I want to be variable:
trialList: ((‘PilotSentences_Block’ + expInfo[‘block’]) + ‘.xlsx’),

You could have different URLs by having?block=1 etc at the end of the URL.

I’ve recently written a tool to sequentially send participants to different URLs that anyone can use. I’d be happy to customise it further if needed.

https://moryscarter.com/vespr/survey.php

1 Like

Thanks, @wakecarter! I tried that before and it wasn’t working but I think it was because I was using “Block” instead of “block”. The solution I came up with works for now, but if I need to use the tool you created later I will take a look. Thanks again!

I’ve just updated my tool to work better with Pavlovia where conditions are assigned in a variable.

e.g. https://moryscarter.com/vespr/survey.php?domain=run.pavlovia.org&folder=Wake/brookes-template-2020/html/?group=&id1=A&id2=B&id3=C

1 Like

How do see your code? Now, I only can see your experiment. Thank you!

Now,I make the block condition file as a variable and it will be preload in the first routine. But sometimes, procedures occur error when the next rountine was executed but the condition file has not fully loaded. I want to know how to add a loading page when the condition files are loading. Thanks!

On my code snippets page there’s code for checking whether a resource is available yet.


Is this part?

But I have some trouble transferring it into my procedures. Do I need copy the fully code into my JS or add some important lines of code into the builder?

That’s the JS code for embedded HTML. I don’t think that’s what you want.