I have a loop (defined in the code component cue_coin_func) which cycles through the x position values of my stimulus (as this is what changes from trial to trial) and I set it to do as many iterations as I have nReps. Is there a better way to set up this loop so that the trial handler understands the nReps?
When I ran your task (which looks nice by the way), I got different errors. It seems they were related to scoping issues, referring to target_list and cue_list being indexed by the loop repetition number. That was due to scoping issues: deleting target_list and cue_list from the manually defined var list of variables in the “begin experiment” tab of the code component on the Instr routine fixed those errors, but then a new one arose:
TypeError: undefined is not an object (evaluating 'this._gui')
which was beyond my meagre JavaScript skills to explore further.
But examining the scoping of your variables might be a good idea. e.g. you define a variable called trials, which probably won’t conflict with the loop of the same name because of how you define its scope, but its still probably a good idea to avoid having the same name refer to different things, just in case the scoping does go awry.
NB there was also a syntax error when running the Python version, due to an errant trials++ appearing in a Python code component, and which simply needed to be deleted. Given that, and the different JavaScript errors, I wonder if the file you pointed to on Pavlovia has been changed since you posted above?
Thanks again for your help- it worked. However, I did a search and this new error did appear in this thread:
However it was solved by making the x and y position belong to two different columns in a conditions file. I’m not using a conditions file so I’ll have to keep looking for help on this problem.