|
Post by Partenope on Nov 22, 2020 14:43:35 GMT
Hi everyone!
I have to create an experiment in which there are overlapping images. Specifically, first image is entire, but there are many overlapping images that hide the first. When participants click with the mouse over one of these overlapping images, the bitmap they have clicked must be removed, showing a part of the first hidden image. I have written this code, but it doesn't work: when I click on the bitmap, this bitmap it is not removed
options
fullscreen
loading text Caricamento
startbutton text Clicca qui
mouse on
fonts
arial 32
bitmaps
rettangolo1
rettangolo2
rettangolo3
rettangolo4
rettangolo5
rettangolo6
rettangolo7
rettangolo8
rettangolo9
zeppola
fixpoint6
istr2
table figure
rettangolo1
rettangolo2
rettangolo3
rettangolo4
rettangolo5
rettangolo6
rettangolo7
rettangolo8
rettangolo9
image1
task osservazione_figure
table figure
draw off
show bitmap image1 # the image that must be hidden by the overlapping images (the following): show bitmap rettangolo1 -300 -200
show bitmap rettangolo2 -300 0
show bitmap rettangolo3 -300 200
show bitmap rettangolo4 0 -200
show bitmap rettangolo5 0 0
show bitmap rettangolo6 0 200
show bitmap rettangolo7 300 -200
show bitmap rettangolo8 300 0
show bitmap rettangolo9 300 200
draw on
readmouse l 1 360000
set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y
show text $number_of_bitmap 200 200
if $number_of_bitmap == 2
unhide rettangolo1
fi
delay 500
save TASKNAME BLOCKNAME @1 TABLEROW RT $number_of_bitmap
block MyBlock1
message istr2 space
tasklist
osservazione_figure 10
end
How could I do to make this work correctly?
Many thanks in advance for your assistance,
have a good day
|
|
|
Post by alexandra (AEC) on Nov 23, 2020 8:15:48 GMT
Hi there, first of all, if you use "unhide" this will actually show the image again while "hide" will remove the image without clearing it from the screen, meaning you then can show the image again using "unhide". If you do not care so much about this you can also use clear.
In order to make sure that the hidden image is not read by readmouse as well, try adding the "range subfunction" to readmouse. readmouse l 1 360000 range 2 10 and set $number_of_bitmap bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 All combined should solve your problem.
If you want all images removed to unhide the image completely, I guess you could do something like this:
[after showing all images...]
readmouse l 1 360000 range 2 10
set $number_of_bitmap1 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10
show text $number_of_bitmap1 200 200
set $RT1 RT
clear $number_of_bitmap1
readmouse l 1 360000 range 2 10
set $number_of_bitmap2 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10
show text $number_of_bitmap2 200 200
set $RT2 RT
clear $number_of_bitmap2
... [and so on]
save TASKNAME BLOCKNAME @1 TABLEROW RT1 $number_of_bitmap1 RT2 $number_of_bitmap2 ...
|
|
|
Post by Partenope on Nov 23, 2020 18:20:46 GMT
It works perfectly, many many thanks!! Furthermore, I would like to insert a section in which participant could choose if he want to keep on removing the overlapping images (in order to understand what does the hidden picture represent) or not. Also, if he doesn't want to keep on removing, he has to indicate what he think the hidden image represent (choosing between 7 options). And this after each overlapping image removed. Please, How could I do that? Is it possible to build? Many thanks in advance for your support and help
|
|
|
Post by alexandra (AEC) on Nov 26, 2020 8:17:21 GMT
An idea would be to place a "button" (an image to click on with sth indicating I want to stop here)somewhere on the screen. So when a participant is clicking on this button image, everything disappears and then the question appears what was on this image or sth like that. Maybe you use while to for this.
while $number_of_bitmap1 != 11 & $number_of_bitmap2 != 11 & [...] # let's say the "button" is the 11th bitmap on the screen
[showing all images...] readmouse l 1 360000 range 2 10 set $number_of_bitmap1 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap1 200 200 set $RT1 RT clear $number_of_bitmap1 readmouse l 1 360000 range 2 10 set $number_of_bitmap2 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap2 200 200 set $RT2 RT clear $number_of_bitmap2 [...]
while_end
clear screen show text your question show bitmap option1 show bitmap option2 [...] readmouse l 1 360000 range 1 9 set $number_of_answer bitmap-under-mouse MOUSE_X MOUSE_Y range 1 9
save TASKNAME BLOCKNAME @1 TABLEROW RT1 $number_of_bitmap1 RT2 $number_of_bitmap2 [...] $number_of_answer RT
|
|
|
Post by Partenope on Dec 1, 2020 9:46:27 GMT
Many thanks for give always a support, I am very thankfull to you! Unfortunately, it doesn't work correctly, in particular the while cicle.
This is the script, have you got any other advice?:
options fullscreen loading text Caricamento startbutton text Clicca qui mouse on
fonts arial 32
bitmaps rettangolo1 rettangolo2 rettangolo3 rettangolo4 rettangolo5 rettangolo6 rettangolo7 rettangolo8 rettangolo9 zeppola biscotti fixpoint6 istr2 Sorpresa Paura TestoUscitaCiclo table figure zeppola biscotti
task osservazione_figure table figure draw off show bitmap @1 show bitmap rettangolo1 -300 -200 show bitmap rettangolo2 -300 0 show bitmap rettangolo3 -300 200 show bitmap rettangolo4 0 -200 show bitmap rettangolo5 0 0 show bitmap rettangolo6 0 200 show bitmap rettangolo7 300 -200 show bitmap rettangolo8 300 0 show bitmap rettangolo9 300 200 show bitmap TestoUscitaCiclo 0 200 draw on while $number_of_bitmap1 != 11 & $number_of_bitmap2 != 11 & $number_of_bitmap3 != 11 & $number_of_bitmap4 != 11 & $number_of_bitmap5 != 11 & $number_of_bitmap6 != 11 & $number_of_bitmap7 != 11 & $number_of_bitmap8 != 11 & $number_of_bitmap9 != 11 # let's say the "button" is the 11th bitmap on the screen readmouse l 1 360000 range 2 10 set $number_of_bitmap1 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap1 200 200 set $RT1 RT clear $number_of_bitmap1 readmouse l 1 360000 range 2 10 set $number_of_bitmap2 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap2 200 200 set $RT2 RT clear $number_of_bitmap2 readmouse l 1 360000 range 2 10 set $number_of_bitmap3 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap3 200 200 set $RT3 RT clear $number_of_bitmap3 readmouse l 1 360000 range 2 10 set $number_of_bitmap4 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap4 200 200 set $RT4 RT clear $number_of_bitmap4 readmouse l 1 360000 range 2 10 set $number_of_bitmap5 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap5 200 200 set $RT5 RT clear $number_of_bitmap5 readmouse l 1 360000 range 2 10 set $number_of_bitmap6 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap6 200 200 set $RT6 RT clear $number_of_bitmap6 readmouse l 1 360000 range 2 10 set $number_of_bitmap7 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap7 200 200 set $RT7 RT clear $number_of_bitmap7 readmouse l 1 360000 range 2 10 set $number_of_bitmap8 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap8 200 200 set $RT8 RT clear $number_of_bitmap8 readmouse l 1 360000 range 2 10 set $number_of_bitmap9 bitmap-under-mouse MOUSE_X MOUSE_Y range 2 10 show text $number_of_bitmap9 200 200 set $RT9 RT clear $number_of_bitmap9 delay 1000 while-end clear screen draw off show text "Che emozione raffigura l'immagine? Clicca col mouse" 0 -200 show bitmap Sorpresa 0 0 show bitmap Paura 0 200 draw on readmouse l 1 3600000 range 2 3 set $number_of_answer bitmap-under-mouse MOUSE_X MOUSE_Y range 2 3 delay 500 save TASKNAME BLOCKNAME @1 TABLEROW $RT1 $number_of_bitmap1 $RT2 $number_of_bitmap2 $RT3 $number_of_bitmap3 $RT4 $number_of_bitmap4 $RT5 $number_of_bitmap5 $RT6 $number_of_bitmap6 $RT7 $number_of_bitmap7 $RT8 $number_of_bitmap8 $RT9 $number_of_bitmap9 $number_of_answer RT
block MyBlock1 message istr2 space tasklist osservazione_figure 10 end
Many thanks in advance for your help and support,
Deborah
|
|
|
Post by alexandra (AEC) on Dec 1, 2020 14:20:22 GMT
Sorry, while might not be working due to using "&" instead of "and". Replace your "&" connecting each condition in your while line with "and" and try again. Please let me know if this works.
|
|
|
Post by Partenope on Dec 1, 2020 23:10:58 GMT
It doesn't work; I have tryed also with "or" because I have thought that it would be ok if the question appears also when only one of these conditions take place, but it doesn't work unfortunately Many thanks for your support; let me know please what do yuo think about; I am really thankfull to you
|
|
|
Post by alexandra (AEC) on Dec 2, 2020 9:56:25 GMT
Hi,
the use of "or" makes absolutely sense as you only need one of the variables with 11 for the while loop to stop. I have tried out your script with different pictures and I have set the bitmap number variables to zero before starting the while loop. The while loop clearly stops when clicking on the 11th image as clicking on other images afterwards is not recognised. The strange thing is that nothing happens afterwards. This is not what should happen. I am sorry I cannot help you more. I will try to think of a different way of coding this experiment but maybe someone else has a better idea or knows why nothing happens after the while loop stops.
|
|
|
Post by Partenope on Dec 4, 2020 18:31:20 GMT
Many Many Thanks anyway! I am very thankfull for your support!
However, maybe someone knows why nothing happens when "while cicle" ends;
Thanks in advance,
Deborah
|
|