Mouse undefined
Hello,
I'm trying to get coordinates of a subject's mouse clicks with inline javascript but I'm getting an error that mouse is undefined.
Previously, I found that coordinates of a subject's mouse clicks were logged as cursor_x and cursor_y, but when I try using these variables in javascript it says these are undefined as well. I think it'll be an easy fix but let me know if anyone's able to help!
Thanks,
Zach
Comments
Hi @zach_researcher ,
Indeed, you can't use the
Mouseobject in aninline_javascriptitem like you can in a Pythoninline_script. But you can use amouse_responseitem and then use the resulting cursor_x and cursor_y variables in a subsequentinline_javascriptitem. Two things come to mind:Runtab of your inline_javascript item? Otherwise the variables won't exist yet...vars.notation (instead of the usualvar.), like so?If you upload your experiment here, we can have a closer look, if needed.
Good luck!
Lotje
Did you like my answer? Feel free to

Hi @lvanderlinden ,
I actually sorted it out! I'm not sure if there's a way around this but each time I mentioned the variables I wrote it as vars.cursor_x and vars.cursor_y. I also defined both variables as 0 at the beginning of the experiment
Thanks,
Zach
Great to hear @zach_researcher !
Did you like my answer? Feel free to
