PsychoJS: loop.thisTrialN; loop.thisN, are constant

URL of experiment:
https://run.pavlovia.org/ba/online_5/html
Description of the problem:
Running an experiment online, results in strange issue.
Counters in output file : loop.thisTrialN; loop.thisN, are constant. They just represent a number that is a total amount of trials in my experiment. They do not show the order as they are supposed to.
Of course, this issue can be avoided by implemented a manual counter that will the job. But it would be good to know what is causes this issue and whether it has any other effect on the experiment and output file.

Have you read my crib sheet (see pinned post)? All loops need to be referred to as “trials” irrespective of their actual name.

Can you give more details please.
In your sheet it is written:
Use the custom loop name when referring to trialList. Use “trials” for other attributes.

I have several loops. Do you they all need to be named "trials’_x? Or?
so the name like ‘practice_cond2’ will not do ?

Sorry – Here’s a new version of my text which I hope is clearer.

Don’t
Refer to custom loop names when using methods .thisN, .finished, etc.

Do
All loops are referred to as “trials”.
Use the custom loop name when referring to trialList. Use “trials” for other attributes.

If you only have one loop that you need to refer to, rename it to “trials”. If you have several then don’t worry about renaming them.

For nested loops the inner loop is referenced. It may not be possible to reference the outer loop.

Hmm. I am not sure whether the loops have to be renamed or not. Even when I rename one of them to trials it still doesn’t help. Output file is fine, it just trials.thisN is a constant number. By constant I mean it is repeated accross all trials with the same number.

Are you saving the value or just looking at the trials.thisN in the data file?

Just looking at trials.thisN in the data file.

Hello @Yev,

This is an issue with the particular version of the PsychoJS library you are using.
Could I encourage you to update to a more recent one, e.g. 2020.2? That should fix it.
Cheers,

Alain

Hi @apitiot
Are you refering to platform verion at pavlovia.org? or Psychopy version? Not sure where I can change it.
I see that my other experiment that has platform verion 2020.1 doesn’t have that issue.
But I can’t change this option somewhy. I remember before it was possible to change.

You would need to generate a new code, from PsychoPy 2020.1 or 2020.2, indeed.

Isn’t the current version still 2020.1.3?

I can confirm that udpading to 2020.1.3 fixed the issue.

I am using v 2020.2.6 and trials.thisN and trials.thisTrialN is giving constant values . trials.thisN gives the total loop length and trials.thisTrialN gives 0.

Are there any updates on this issue? I can’t seem to find much information on it but I tried several different versions of PsychoPy and the issue remains. I did a console.log(trials.thisN); in the js code and it just shows 0 in the output. Also made sure that my loop is called trials. In the end I had to make a workaround and manually keep track of the trial number.

I am using 2020.2.10 and it works fine. The old issue I reported was only observed in 2020.1.2. Though as I see people still have this issue in later versions.
Remember that you would need to make a new experiment from the scratch in the new version.

.thisN isn’t working for me in 2020.2.10

I also don’t usually need to make experiments from scratch when I change version.

That could the very problem you face. Look at the comment above from apitiot. The new code has to be generated in a new version. If you made your expeirment in the version where a bug was present and then just re-open it in a new version, this bug will transfered as well.