|
Post by Joe Butler on Aug 15, 2020 21:12:51 GMT
Hello,
I've either not understood the function, or there may be a bug with using readmouse and also setting the background. The problem I get, is if I set the background, then no matter which of the bitmaps I then select, I get 1 as a value.
I've tried using range (e.g. 2 4), different versions of the browser version of psytoolkit, but I always get the same error if I set the background. If I do not set the background, then I get the appropriate bitmap number.
Is this just how the function works?
Best wishes, Joe
# enter code
# in this task, 3 bitmaps are shown, and participant needs to select one
options mouse on
fonts arial 20
task click show background 128 128 128 #1 draw off show text "AAA" -200 0 show text "BBBB" 0 0 show text "cCCC" 200 0 draw on readmouse l 1 5000 range 2 4 set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y show text $number_of_bitmap 200 200 delay 500 clear screen delay 500 save RT $number_of_bitmap
block test tasklist click 3 end
|
|
|
Post by Joe Butler on Aug 15, 2020 21:46:09 GMT
Ooops I got so carried away I didn't search the forum. I see I must set it up under options!
Best wishes, Joe
|
|
|
Post by Joe Butler on Aug 15, 2020 22:28:46 GMT
Actually if I have stimuli appear and disappear, before the images I am supposed to choose, then the function still acts odd.
I've adapted the stimuli to run how I want my experiment to look, and I'm getting strange variables - e.g. 3 when I click the right block, but 0 when I click the left block. I get the same problem also if I set the range to 3 4. Previously showing and clearing bitmaps seems to mess up the function.
Code I used to test this below:
&&&&&&&&
# in this task, 3 bitmaps are shown, and participant needs to select one
options mouse on background color 128 128 128
fonts arial 20
task click show text "gggg" delay 1000 clear -1 show text "aaaa" delay 1000 clear -1 draw off show rectangle 165 0 140 32 30 30 30 #5 show rectangle 15 0 140 32 30 30 30 #6 draw on readmouse l 1 5000 range 3 4 set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y show text $number_of_bitmap 200 200 delay 500 clear screen delay 500 save RT $number_of_bitmap
block test tasklist click 10 end
|
|
|
Post by PsyToolkit on Aug 16, 2020 13:56:09 GMT
Ooops I got so carried away I didn't search the forum. I see I must set it up under options! Best wishes, Joe You can do it both ways.
If you set the background color in the "options", then it is immutable throughout the experiment. So if you want the background color white forever in your experiment, it is easiest to do in options.
If you want to change it from task to task or trial to trial, the "show background" should be used. I need to check your other comments as well.
|
|
|
Post by PsyToolkit on Aug 16, 2020 14:19:13 GMT
The solution is this:
In your line
set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y
you can add a range, in you case, range 3 4
Therefore, this works (add the text in red):
set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y range 3 4
|
|