I was wondering if anyone has got nested loops to work in Pavlovia? I’ve seen a few posts saying people have had difficulties, and I had the same thing (worked fine locally, but got a ‘Javascript error’ when working on Pavlovia).
Thanks for your response! I apologise - the problem turned out to be something completely different which I’ve now fixed. (If this helps anyone, it was that I was using variables named ‘image’ and ‘sound’ which seems to work in the Python but not JS version).
I actually now have another problem with converting from Psychopy to JS. I’m trying to put in a stimulus which appears for a variable duration. To do this, I’m defining a variable at the beginning for the duration called ‘intertrialint’, and will ultimately want to set this to a changing value each repeat of the routine.
However, while I can pass the ‘intertrialint’ variable into the ‘duration’ part of the stimulus in Psychopy (Python), when I try to run this online (with JS) it says ’ ReferenceError: asarray is not defined’.
Having looked at the JS version of the script, this seems to be because in the Python version it has a line saying ‘from numpy import … asarray’
whereas in the JS version it just skips to asarray being used, in the line:
frameRemains = 1.0 + asarray(intertrialint) - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
Do you know why this is, why the possibility of changing this variable is not passing to Javascript?