URL of experiment: https://pavlovia.org/run/jnasrini/m2s/html/
Description of the problem:
Hi Friends,
I’m trying to make a web demo of an experiment that checks which image the participant clicked and returns feedback depending on whether they clicked the correct one. I’ve managed to get most of the way through converting my python code snippet into JS, but I’ve gotten stuck on the error message below. I’m using the ImageStim.contains() method as I think it’s meant to be used, and it works on the desktop version, but I get the error below on Pavlovia.
Unfortunately we encountered an error:
TypeError: stimulus.contains is not a function
Try to run the experiment again. If the error persists, contact the experimenter.
This may very well be due to my limited knowledge of JS, but the experiment runs as expected on desktop. The JS code snippet I created for checking the stimulus is copied below, and the full js module is here: (https://gitlab.pavlovia.org/jnasrini/m2s/blob/master/html/M2S_Mockup.js)
for (stimulus in [TopL, TopR, BottomL, BottomR]) {
if (stimulus.contains(mouse_3)) {
if (stimulus.image == Teach) {
msg = "Good Monkey!";
color = "green";
}
else {
msg = "Bad Monkey!";
color = "red";
}
}
}
TopL, TopR, BottomL, BottomR are all ImageStim components that I’ve created in the prior routine.
Let me know if I can provide any other helpful info, and thanks so much for your time!
Best,
Jad