Post by scylla on Dec 29, 2022 12:41:09 GMT
Hi,
I would like to run multiple while loops at the same time, but I don't find any documentation or thread in this forum to do that and I didn't find how to do in my own script.
Here is my problem: I would like to program a visual search task during which the stimuli move continuously on the screen (= an inattentional blindness task just as this : Inattentional Blindness Task). I fund on the documentation that you could do this type of task quite easily using the sprite command, but it works only on your desktop and on Linux. So I can't use this function in my experiment because I would like to run an online experiment. Moreover, I know that I could insert a video clip in my experiment but I would rather not to do that because it's less malleable and have fewer possibilities. So I decided to mainly program this task using the relocate function.
But I have little troubles for doing it: In this task I normally have 10 stimuli that move simultaneously on the screen and I would like to dissociate and randomize the movement of each one on the screen. For that I use some while loops for moving these stimuli but my problem is that each loop is run one by one and so each stimulus move only when the first stop.
So I'm wondering if there is a way to run simultaneously independent while loops ? Here is the type of script I use (that I made simpler for my explanations) :
"
options
fullscreen
set &Size_Rectangle 20 # Define the size of the stimuli for the rest of the experiment
part Conditions
set &Side_Right expression 400 - &Size_Rectangle
set &Side_Left expression -400 + &Size_Rectangle
set &Side_Top expression 300 - &Size_Rectangle
set &Side_Bottom expression -300 + &Size_Rectangle
part IB1 # Move the green stimulus
while $x1 > &Side_Left
set $x1 decrease 3 # From right to left
relocate 2 $x1 $y1
delay 5
while-end
while $x1 < &Side_Right # From left to right
set $x1 increase 3
relocate 2 $x1 $y1
delay 5
while-end
part IB2 # Move the red stimulus
while $x2 < &Side_Right
set $x2 increase 3 # From left to right
relocate 3 $x2 $y2
delay 5
while-end
while $x2 > &Side_Left
set $x2 decrease 3 # From right to left
relocate 3 $x2 $y2
delay 5
while-end
part IB_Simultaneous # Move the red and the green stimuli simultaneously
while $x1 > &Side_Left
set $x1 decrease 3
relocate 2 $x1 $y1
set $x2 increase 3
relocate 3 $x2 $y2
delay 5
while-end
task Moving
part Conditions
set $x1 random -400 400 # random x1 position
set $y1 random -300 300 # random y1 position
set $x2 random -400 400 # random x1 position
set $y2 random -300 300 # random y1 position
show rectangle 0 0 800 600 128 128 128 # show the grey background rectangle
show rectangle $x1 $y1 &Size_Rectangle &Size_Rectangle green # show a green rectangle
show rectangle $x2 $y2 &Size_Rectangle &Size_Rectangle red # show a green rectangle
delay 1000
part IB2
part IB1
part IB_Simultaneous
delay 2000
block test
tasklist
Moving 1
end
fullscreen
set &Size_Rectangle 20 # Define the size of the stimuli for the rest of the experiment
part Conditions
set &Side_Right expression 400 - &Size_Rectangle
set &Side_Left expression -400 + &Size_Rectangle
set &Side_Top expression 300 - &Size_Rectangle
set &Side_Bottom expression -300 + &Size_Rectangle
part IB1 # Move the green stimulus
while $x1 > &Side_Left
set $x1 decrease 3 # From right to left
relocate 2 $x1 $y1
delay 5
while-end
while $x1 < &Side_Right # From left to right
set $x1 increase 3
relocate 2 $x1 $y1
delay 5
while-end
part IB2 # Move the red stimulus
while $x2 < &Side_Right
set $x2 increase 3 # From left to right
relocate 3 $x2 $y2
delay 5
while-end
while $x2 > &Side_Left
set $x2 decrease 3 # From right to left
relocate 3 $x2 $y2
delay 5
while-end
part IB_Simultaneous # Move the red and the green stimuli simultaneously
while $x1 > &Side_Left
set $x1 decrease 3
relocate 2 $x1 $y1
set $x2 increase 3
relocate 3 $x2 $y2
delay 5
while-end
task Moving
part Conditions
set $x1 random -400 400 # random x1 position
set $y1 random -300 300 # random y1 position
set $x2 random -400 400 # random x1 position
set $y2 random -300 300 # random y1 position
show rectangle 0 0 800 600 128 128 128 # show the grey background rectangle
show rectangle $x1 $y1 &Size_Rectangle &Size_Rectangle green # show a green rectangle
show rectangle $x2 $y2 &Size_Rectangle &Size_Rectangle red # show a green rectangle
delay 1000
part IB2
part IB1
part IB_Simultaneous
delay 2000
block test
tasklist
Moving 1
end
"
So my question is: could it be possible to run simultaneously "part IB1" and "part IB2" without define my stimuli movements in the same loop just as in "part IB_Simultaneous" ?
I thank you in advance for you reply and I will be so happy if someone find a way to do this type of request...
Sincerely