|
Post by Partenope on Mar 23, 2021 19:34:40 GMT
Hi everyone! I have problems in coding while cycles; in particular, the task consist in presenting stimuli on the screen, and participants have to recall these stimuli; but I would like to give to parctipants the possibility of exiting from the cycle if they don't remember the sequence (by clicking on the "done" bitmap); and at the same time I would like to save all of responses they recall (but I not sure it could work with while cycle without overwrite previous participants' recalls). This is the script but the while cycle doesn't work correctly:
bitmaps
emotion1 emotion2 emotion3 emotion4 emotion5 emotion6 emotion7 done
task emotion set $emotion random 1 7 set $emotion1 random 1 7 while $emotion1 == $emotion set $emotion1 random 1 7 while-end
show bitmap $emotion delay 2000
clear -1
delay 500
show bitmap $emotion1 delay 2000
clear -1
delay 500
draw off
show bitmap emotion1 -171 -200
show bitmap emotion2 -4 -200
show bitmap emotion3 161 -200
show bitmap emotion4 -170 -90
show bitmap emotion5 -2 -89
show bitmap emotion6 163 -86
show bitmap emotion7 -170 10 show bitmap done 0 250
draw on
set $start 0
readmouse l 1 3000 range 3 10 while $start != 10 readmouse l 1 2000 range 3 14
set $recall UNDER_MOUSE
set $RTrecall RT
while-end
delay 100
save TASKNAME $emotion $emotion1 $recall $RTrecall
block myblock
tasklist
emotion 1
end
|
|
|
Post by danaleighton on Apr 8, 2021 17:26:53 GMT
I am not sure exactly what you mean by "doesn't work correctly" but if you want to save the responses during the WHILE loop, you might try adding them to an array variable, so you will have an array with all of the responses. Also - in the WHILE loop above, I do not see anywhere that $start is incremented, and so I think the loop will be endless.
|
|
|
Post by Partenope on Apr 9, 2021 21:42:29 GMT
Thank you very much! Yes, I would mean to how to save responses during the while loop; Very useful, thanks! I have to create an array variable and add a IF sentence that increase in a condition in order to make while ending; Thank you very much
|
|