|
Post by Partenope on Jan 19, 2022 12:53:31 GMT
Hi everyone! I have to create a task in which tere are 4 stimuli in total and in each trial it could appear one of the 4 stimuli randomly selected by the software. This stimulus could appear each time on 4 different locations on the screen. My first problem is this one: 1. How I can randomize the position on the screen for each trial? Moreover, after the presentation of this stimulus, it has to appear a smiling face 50% half the time, and another face for the other half of the time. So, my problem is: 2. How can I tell to the software to show this smiling face precisely half the time, and the other face precisely for the other 50% of the times? Thank you in advance, this is my script at the moment, I will appreciate any suggetion options fullscreen bitmaps child1 child2 child3 child4 fixpoint smilingface otherface table selection child1 child2 child3 child4 task selection table selection show bitmap fixpoint delay 500 clear -1 delay 500 show bitmap @1 #this one has to appear in 4 different locations on the screen and not just at the centre readmouse l 1 3000 set $number_of_bitmap UNDER_MOUSE clear -1 delay 500 show bitmap smilingface #this one has to appear half of the time (and only if child1 has appeared) delay 1000
clear -1 delay 500 save TASKNAME BLOCKNAME RT $number_of_bitmap block MyBlock tasklist selection 10 end
|
|
silk
Experienced
Posts: 32
|
Post by silk on Jan 29, 2022 17:52:35 GMT
Hi there,
I don't know if it is too late or not but here is an answer using arrays.
First, what you can do is define arbitrary x and y coordinates using arrays to generate all the possible locations of the picture. See the code below:
By doing so, the picture will always appear in one of the 4 possible locations. However it will be entirely random and you might want to control that. For instance you might want the current location of the picture be different from the previous one. This can be done by remembering the coordinates from the previous trial and using some while and if statements:
Note that this code does not balance the number of times the picture appears on each location. In other words there is a (very very low) chance that a location is never chosen. It is hard to fix with total randomization and would certainly need a more complex code.
For the second question, I would create an array with two types of values (for instance, 0 and 1). The size of this array (= the sum of the number of 0 and 1) should be equal to the number of trials for which you want to show a face. Then, for each of those trial we select and remove 1 of the 2 values from this array to decide which face to show.
Note that there are more straightforward ways of doing that, but this way of doing is clear and you don't have to make a lot of edits if you want to make changes to your experiment (for instance 60/40% instead of 50/50%).
|
|
|
Post by Partenope on Jun 6, 2022 11:13:11 GMT
Thank you very much!
Very helpful, I've really appreciated it!
Have a good day
|
|