Description of the problem: I created a script using Builder that compiles and runs fine on Desktop, but hiccups when turned into the online/JS version.
The script has a 12-AFC component where participants need to use their mouse to choose one of 12 possible images displayed on the screen. The JS error I get is:
TypeError: obj.contains is not a function
The code snippet where the error seems to be is:
for obj in …clickableList:
if obj.contains(mouse):
gotValidClick = True
mouse.clicked_name.append(obj.name)
mouse.clicked_image.append(obj.image)
As mentioned, the python code works fine on Desktop, so the problem seems to be in the autoconversion from py to js code. I followed some this thread’s recommendation, but wasn’t able to fix the problem.
Thank you
Hi,
Which version of PsychoPy are you using? I think there may be a bug in the mouse component for 2024.1.5
Best wishes,
Wakefield
Yes, I used the most recent psychopy version (2024.1.5). I am not very familiar with the software, is it possible to compile the same script with earlier versions to solve this problem, and if so, what version would you recommend? Thank you!
See if it works by selecting 2024.1.4 from Experiment Settings.
This will hopefully be fixed in 2024.2.0
I tried compiling and running by selecting 2024.1.4, but to no avail unfortunately. The py code works, but the JS code throws the same error on localhost and Pavlovia alike.
Hi again, I waited a few months for version 2024.2.0 and 2.1 to appear. After running my script with the new versions (as suggested above), the JS code still throws the same error as before, both on localhost and on Pavlovia (it works fine as a.py script on desktop).
Am I the only one experiencing this problem with the mouse click not working on JS?
mouse.corr does work in 2024.2.1
https://run.pavlovia.org/test-suite/mouse_correct_bug/
if expInfo['mouse.corr'] == 'yes':
msg = '.corr ' +str(mouse.corr) + '\n\n.clicked_name ' + str(mouse.clicked_name) + '\n\n,time ' + str(mouse.time)
elif expInfo['mouse.corr'] == 'no':
msg = '.clicked_name ' + str(mouse_2.clicked_name) + '\n\n.time ' + str(mouse_2.time)
elif expInfo['mouse.corr'] == 'clickable field':
msg = '.clicked_name ' + str(mouse_3.clicked_name) + '\n\n.time ' + str(mouse_3.time)
Check in an incognito tab/private browsing window just in case you are still seeing the old version.