OS (e.g. Win10): MacOS 10.14.6 PsychoPy version (e.g. 1.84.x): 2020.2.4 Standard Standalone? (y/n) If not then what?: y What are you trying to achieve?: implement a break
I know this problem has been coming up over and over, but I can’t find a solution. The fields trials.thisN and trials.thisTrialN won’t get updated in the JS script and remain constant (on 0). Therefore, I cannot implement a loop break to make participants rest after a certain number of trials. The script works flawlessly when I run it locally. The problem is only with JS.
Hi @thomas_pronk, is this something the dev team are aware of? There might have been long-standing loop-related issues, but getting consistency between the desktop and online versions would be important for this functionality.
I think we’re being bit by the same problem. We are trying to set a stimulus based on a list whose length is the same as the number of trials. Is there any update on this issue? (Sorry if I failed to find a relevant post.)
There have been some changes in how loop variables work in newer versions of PsychoJS. Try using this variable instead: snapshot
Now, it will have most properties you’re after (like snapshot.thisN), but there is some room for improvement, since it doesn’t have all the properties that PsychoPy offers, and it will complicate things with nested loops. I made a little test to illustrate these issues, for when we’ll go optimize this. Likely to take a while though, since we’ll probably bundle this up with some other upgrades of the looping system.