Post by navybox on Mar 24, 2020 14:45:24 GMT
Dear all,
I am having problems using the range option associated to readmouse and bitmap-under-mouse commands. More specifically, it looks like clicks outside the defined range of bitmaps are not ignored or, when I use it with bitmap-under-mouse, I get the following error:
set $bit bitmap-under-mouse range 2 2
Problem: Unknown variable range
I have already dealt with this problem in the past and I ended up using multiple if statements to make things happen only when participants clicked on what I wanted, which I can not do in this case.
I think the problem I am having derives from the fact that I first set my background color to white (which means a rectangle is displayed first) and then I draw a second black rectangle on top of it. What I want is for participants to click only on this second rectangle, so I use the following code
readmouse l 2 300000 range 2 2
set $bit bitmap-under-mouse MOUSE_X MOUSE_Y
When I run my experiment, I make sure I am clicking over the black rectangle and I move to the following trial (thus the click is recorded as if I have clicked on the 2nd rectangle), but when I look at the data to check tha variable $bit (the bitmap that was clicked) I only get the value 1 as if I had clicked on my background.
When keeping the default black background and setting the range to 1 1, everything seems to work smoothly so I guess part of the problem might be that the MOUSE_X and MOUSE_Y position are recognized as part of the background and not part of the second rectangle?
Still, if this is one issue, I should not be able to move to the following trial when clicking because my position is never recorded as over the 2nd, required, rectangle
Many thanks to anyone who could help with this!
Marina
I am having problems using the range option associated to readmouse and bitmap-under-mouse commands. More specifically, it looks like clicks outside the defined range of bitmaps are not ignored or, when I use it with bitmap-under-mouse, I get the following error:
set $bit bitmap-under-mouse range 2 2
Problem: Unknown variable range
I have already dealt with this problem in the past and I ended up using multiple if statements to make things happen only when participants clicked on what I wanted, which I can not do in this case.
I think the problem I am having derives from the fact that I first set my background color to white (which means a rectangle is displayed first) and then I draw a second black rectangle on top of it. What I want is for participants to click only on this second rectangle, so I use the following code
readmouse l 2 300000 range 2 2
set $bit bitmap-under-mouse MOUSE_X MOUSE_Y
When I run my experiment, I make sure I am clicking over the black rectangle and I move to the following trial (thus the click is recorded as if I have clicked on the 2nd rectangle), but when I look at the data to check tha variable $bit (the bitmap that was clicked) I only get the value 1 as if I had clicked on my background.
When keeping the default black background and setting the range to 1 1, everything seems to work smoothly so I guess part of the problem might be that the MOUSE_X and MOUSE_Y position are recognized as part of the background and not part of the second rectangle?
Still, if this is one issue, I should not be able to move to the following trial when clicking because my position is never recorded as over the 2nd, required, rectangle
Many thanks to anyone who could help with this!
Marina