Accepting a mouse click only within a ROI?
Hi all
I am implementing an experiment where participants respond by clicking four times on four different buttons presented on screen. So I created a sketchpad with four different rectangles, and then I linked this sketchpad to four consecutive mouse_response items.
It all works fine, apart from the fact that participants may ignore the rectangles and click anywhere on the screen.
Is it possible to constraint the responses? To be more clear, I would like to accept a click as a legitimate response only if the position of the cursor lies within one of the four rectangles. Any suggestions?
Thank you all for your help,
Fotis

Comments
Hi Fotis,
have you seen this discussion? It looks like it could be relevant for your problem.
Good luck.
Eduard
Hi @eduard
Thank you for your response, but I'm afraid the solution of repeating the entire trial significantly changes the design of the experiment, and is not suitable for me.
I don't need the whole trial to be repeated, I only need to restrict the mouse clicks on ROIs defined in a linked sketchpad.
May I kindly suggest (@sebastiaan) that in a future version of OpenSesame you consider implementing this functionality?
Until then I suppose i will need to implement this in python, using an inline script after the sketchpad:
my_mouse = Mouse(buttonlist=[1,2], timeout=2000) my_mouse.flush() my_mouse.set_visible() while True: button,(x,y), time = my_mouse.get_click() if (x > -160 and x< -32 and y>-32 and y<32) or (x > 32 and x < 160 and y>-32 and y<32): breakThank you for your time,
Fotis
Hi Fotis,
Until then I suppose i will need to implement this in python, using an inline script after the sketchpad:
Great! That would have been my approach as well. However, if you wrapped the response in a separate loop, you could probably get away with the repeat_cycle approach from the old discussion. Instead of the entire trial, only the last response phase would be repeated. Well, at least that is my hunch, I haven't actually tried that.
Good luck,
Eduard