lilly
New Member
Posts: 13
|
Post by lilly on Apr 15, 2020 13:29:44 GMT
Hello,
I am recoding an E-prime experiment to an online experiment using PsyToolkit. I have looked at some examples and after some tweaking, the experiment runs. However, I am not sure if it does exactly the same as the original. In the original, I showed the stimuli for 52 ms, while simultaneously collecting a response. After that, I showed a blackscreen for 648 ms in which I continued collecting the response. Thus, participants have 700 ms to respond, starting from the presentation of the stimuli (which was visable for 52 ms).
So far, I have this:
show text @1 0 0 255 255 255
delay 52
readkey @3 700 But I am not sure if this means it starts collecting during the stimulus presentation of 52 ms or after (I am afraid it starts after the 52ms, which means the total trial time is 52+700 rather than 52+648 but with a total response time of 700. If possible, I would like to show the stimuli for 52ms, and use the readkey for 700ms in total, starting at the same time as the show text.
Kind regards,
|
|
|
Post by PsyToolkit on Apr 15, 2020 22:32:21 GMT
You can do this, but you would do it like this: show text @1 0 0 255 255 255 readkey 1 52 clear -1 set $tmprt RT
set $tmprt STATUS if STATUS == 3 readkey 1 600
set $finalrt expression RT + $tmprt fi if STATUS != 3 set $finalrt expression $tmprt fi
This way, you "wait" your 52 milliseconds while also checking if a key is pressed. Now this is very unlikely because normally people cannot respond in that time (a choice reaction time takes at least 200+ milliseconds).
In any case, this solves the issue fully.
Basically, the RT and STATUS variables are set by "readkey" and overwritten. That is why you temporarily store them in $tmprt.
Hope that helps.
|
|
|
Post by lilly1 on Apr 16, 2020 7:13:48 GMT
Thank you for your reply and solution! I have tried to implement the snippet of code and it runs without errors, but the feedback doesn't work properly anymore. I think it is because I also use STATUS to give feedback which happens directly after the showtext piece.
My whole task is:
task practice table trials keys s h font Large show bitmap blackscreen delay 1000 clear 1 show text "^" 0 25 255 255 255 delay 250 clear 2 show text @1 0 0 255 255 255 delay 52 readkey @3 700 font Small if STATUS == CORRECT clear 3 show text "+++" 0 0 0 255 0 delay 500 clear 4 fi if STATUS = WRONG clear 3 show text "---" 0 0 255 0 0 delay 500 clear 4 fi if STATUS = TIMEOUT clear 3 show text "!!!" 0 0 255 255 255 delay 500 clear 4 fi delay 500 save @1 @2 BLOCKNAME STATUS RT
I have tried implementing your solution like this:
task practice table trials keys s h font Large show bitmap blackscreen delay 1000 clear 1 show text "^" 0 25 255 255 255 delay 250 clear 2 show text @1 0 0 255 255 255 readkey @3 52 clear 3 set $tmprt RT set $tmprt STATUS if STATUS == TIMEOUT readkey 1 648 set $finalrt expression RT + $tmprt fi if STATUS != TIMEOUT set $finalrt expression $tmprt fi font Small if STATUS == CORRECT show text "+++" 0 0 0 255 0 delay 500 clear 4 fi if STATUS = WRONG show text "---" 0 0 255 0 0 delay 500 clear 4 fi if STATUS = TIMEOUT show text "!!!" 0 0 255 255 255 delay 500 clear 4 fi delay 500 save @1 @2 BLOCKNAME STATUS RT
But it doesn't read the STATUS correctly anymore. I have also tried combining the STATUS statements but it didn't work. I am new to scripting but with the help of the manual I have gotten this far. Any help is greatly appreciated!
Kind regards!
|
|
|
Post by PsyToolkit on Apr 16, 2020 10:21:11 GMT
Hello Lilly, thank you for your post and it looks like you are getting there. Ultimately, coding is always trial and error until it works.
A couple of points that might help:
1) Why do you show bitmap "blackscreen", the screen is black by default so that is not necessary.
2) The "set" command assigns a value to the variable $tmprt. Because you now have "set $tmprt RT" followed immediately by "set $tmprt STATUS", the variable $tmprt contains only the value of the STATUS. You need to choose a different variable name, for example "set $tmpstatus STATUS".
I think you will manage soon.
|
|
lilly
New Member
Posts: 13
|
Post by lilly on Apr 16, 2020 13:28:00 GMT
Thank you for the fast reply!
After some tweaking, it worked! I show the blackscreen so I am sure it is shown for the exact amount of time. I agree that this could be better, but for now I am just content with the working code. It was indeed the $tmprt variable which was used twice. After adjusting this, the code worked, but the saved RT ($finalrt) were wrong for correct and wrong trials, as it was set to
if STATUS != TIMEOUT set $finalrt expression $tmprt. After changing this, the final code for the task-part (so others can learn/use this example) was like this:
task practice table trials keys s h font Large show bitmap blackscreen delay 1000 clear 1 show text "^" 0 25 255 255 255 delay 250 clear 2 show text @1 0 0 255 255 255 readkey @3 52 clear 3 set $tmprt RT set $tmpst1 STATUS if STATUS == TIMEOUT readkey @3 648 set $finalrt expression RT + $tmprt fi if STATUS != TIMEOUT set $finalrt expression RT fi font Small if STATUS == CORRECT show text "+++" 0 0 0 255 0 delay 500 clear 4 fi if STATUS == WRONG show text "---" 0 0 255 0 0 delay 500 clear 4 fi if STATUS == TIMEOUT show text "!!!" 0 0 255 255 255 delay 500 clear 4 fi delay 500 save @1 @2 BLOCKNAME STATUS $finalrt Thanks again!
|
|
|
Post by PsyToolkit on Apr 16, 2020 15:31:28 GMT
|
|