|
Post by timface on Mar 26, 2020 2:32:20 GMT
Hi,
I would like to have visual stimuli be animated at the same time as a response is required (readkey) on the web version.
I have checked the docs and it seems like keystatus is what I would need but is only for Linux Version. Given the current pandemic I am unable to have the participants come into the lab so need to provide the web version.
Is there a way to animate and readkey at the same time in the web version?
Cheers, Tim
|
|
|
Post by PsyToolkit on Apr 1, 2020 8:57:23 GMT
Hi, You can do some animation, but it is a bit tricky. Basically, you can show a bitmap, then wait a bit (but instead of a delay use a "readkey" to see if a key was pressed and then on. For example: show bitmap my_bitmap1 readkey 1 100 set $rt1 RT set $status1 STATUS show bitmap my_bitmap2 readkey 1 100 set $rt2 RT set $status2 STATUS show bitmap my_bitmap3 readkey 1 100 set $rt2 RT set $status2 STATUS
This way, you can show a stimulus in 3 different stages (for example something that moves, etc). It is fairly rudimentary, but that is how it is. For most experiments, this would suffice. Let me know if that helps and for more advice, also feel free to email me.
Gijsbert Stoet
|
|
|
Post by timface on Apr 15, 2020 1:53:05 GMT
Thanks for that! I have a mostly working experiment now, there is a minor issue where if the user presses the button in the time between readkeys then their response is not recorded. I found minimising the time between readkey calls seems to help with this.
|
|
|
Post by Lena on Jun 2, 2020 16:36:51 GMT
Hello,
i had a similar problem and thought, this might be a solution for me. But now I figured out, it does not work properly.
I am working on an adaption of n-back task and usually for this task the stimulus is only shown for ~500ms, but the participant may still response when the stimulus is not shown anymore. Reaction time is the time after stimulus onset, maximum until onset of next stimulus.
So I would have to clear the screen while still waiting for keyboard response - or not, if response was in first 500 ms.
I implemented it like that. But I still have the problem, that when participant responds exactly after 500ms the data is gathered as if there was no response at all. I think ... I have weird rows in my data I canot explain, because I *know* that I always pressed a key...
I would be very thankful for any further ideas how to improve my code and solve this issue...
@psytoolkit: For the future it would really be a nice option to be able to put "readky" into a while-loop or something like that and perform other things while still waiting for the key.
Code:
readkey $requiredresponse &stimulustime set $extrawait expression &stimulustime - RT set $rt1 RT delay $extrawait clear 1 ## 1 is the digit stimulus set $score1 0 if STATUS == 1 set $score1 1 fi ############ if $rt1 == 500 readkey $requiredresponse &delay set $extrawait expression &delay - RT set $rt2 RT delay $extrawait set $score2 0 if STATUS == 1 set $score2 1 fi fi if $rt1 < 500 delay &delay set $rt2 0 set $score2 0 fi set $rtG expression $rt1 + $rt2 clear 2 3 ## 2 and 3 are the grey bars above and beneath the stimulus (instead of fixation cross) ### save digits for next trials set &nback2 &nback1 set &nback1 $currentdigit ### save the data save &trialcount $currentdigit $memory $score1 $score2 STATUS KEY $rt1 $rt2 $rtG &nback2 &nback1
Data:
1 3 3 1 0 1 2 437 0 437 0 3 2 8 1 1 0 1 2 351 0 351 3 8 3 2 2 1 0 1 2 445 0 445 8 2 4 10 2 1 0 1 2 457 0 457 2 10 5 7 2 0 0 3 1 500 2000 2500 10 7 6 7 3 0 1 1 2 500 476 976 7 7 7 5 2 0 1 1 2 500 78 578 7 5 8 8 3 0 0 2 1 500 156 656 5 8 9 2 2 0 0 3 1 500 2000 2500 8 2 10 8 1 0 1 1 1 500 119 619 2 8 11 2 1 0 0 2 2 500 54 554 8 2
|
|