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
Hi all,
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.
Hey @treelen, sorry to hear PsychoJS is giving you trouble, would it be possible to let me access your repo or send me a .psyexp so that I can investigate a bit further? Here to help, thanks, s.
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.
@wakecarter, we’d like to be sure whatever you address gets picked up by us promptly; be welcome to get directly in touch (via e-mails or our Teams workspace)
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.)
We were using v.2021.1.2. I updated to v2021.1.4. The behavior still seems to be the same. Here’s the web console log:
TypeError: graphs[trials.thisN] is undefined
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.