Finish routine pavlovia


I am looking for the equivalent of
if prac_trials.thisN == 19 :

in JS code? I heave tried:
if (prac_trials.thisTrialN == 19) {
continueRoutine = false;

but it just runs through the whole trial list. I haven’t found any other solutions from my searches.

The reason for doing this is that I would like to give my participants a quick trial run.

Thank you.

Hi, the JS code you currently have doesn’t end the loop and just the routine. What you need is this

if ((prac_trials.thisN === 19)) {
    prac_trials.finished = true;

You can also use the Auto → JS feature in the code component to get this code snippet

The Auto translate doesnt work for me which is why I was trying to alter it. And the alteration also did not fix the problem. I am working from an older version though because my institution makes it difficult to update anything. Perhaps the code works in a newer version. I have found a less elegant work around. Thanks for your help anyway.

If the Auto translate doesn’t work for you, I would focus on this issue.

If you mean you can’t use it for this component, Auto translate in a dummy component then copy and paste

I found a work around. There is always a different way to do things. Thank you anyway.