|
Post by anke2212 on Dec 17, 2020 15:04:32 GMT
Hi everyone, I was wondering whether it is possible to combine the 'fixed' and 'repeat_on_error' functions? We would like the stimuli to appear in the order that we decided AND that when they make a mistake, the same stimulus is shown again. Thank you in advance for you help with this! Kind regards, Anke ---------------------------------------------- This is the code that we have for now: options fullscreen bitmapdir Stimuli set &maxResponseTime 15000 set &maxResponseTime2 3000
bitmaps too_slow wrong_key Verification1 Verification2 Verification3 Verification4 Verification5 Verification6 Verification7 Verification8
table Verification "Left_Pinky" Verification1 -300 1 "Left_Ringfinger" Verification2 -225 2 "Left_Middle_finger" Verification3 -150 3 "Left_Index_finger" Verification4 -75 4 "Right_Index_finger" Verification5 75 5 "Right_Middle_finger" Verification6 150 6 "Right_Ringfinger" Verification7 225 7 "Right_Pinky" Verification8 300 8
task Verification table Verification keys a z e r u i o p show bitmap @2 readkey @4 &maxResponseTime clear -1 if STATUS == WRONG error show bitmap wrong_key delay 1000 fi clear -1 save BLOCKNAME TRIALCOUNT @4 KEY RT STATUS
####################### ## blocks start here ## #######################
block Verification tasklist Verification 8 repeat_on_error && fixed end delay 1000
|
|
silk
Experienced
Posts: 32
|
Post by silk on Dec 18, 2020 16:01:59 GMT
Hi, Yes, it is possible to combine the repeat_on_error and the fixed parameters, without using "&&" :tasklist mytask 10 repeat_on_error fixed end Note that it seems that the fixed parameter must appear at the end to work, I don't know why... The repeat_on_error parameter has the following behaviour (based on my own tests, correct me if I'm wrong):- Show the first stimulus of your table on trial 1.
- If correctly answered, move on to trial 2 and show stimulus 2.
- If wrongly answered, move on to trial 2 and show again stimulus 1.
Basically, this means that the repeat_on_error parameter indicates that the previous stimulus will be selected again for the next trial if you wrongly answered (i.e. if the error instruction is activated). What is important is that you move to the next trial rather than repeating the current one: let's say I have 5 stimuli in my table and 5 trials for my task, if I answer wrongly for the first trial, the first stimulus will be shown again on the second trial... And if I answer wrongly on the second trial, the first stimulus will be shown again on the third trial, and so on and so forth... It means that at the end of your 5 trials you didn't see all your stimuli, which is not what you want.One possibility to avoid this problem is to say in the script: don't leave this trial until I'm correct -- wihch can be done by using a while instruction instead of the repeat_on_error parameter. Something like this: - Say that I'm not allowed to move to the next trial.
- While I'm not allowed to move to the next trial:
a. If I'm correct, say that I can move to the next trial. b. If I'm wrong, keep saying that I'm not allowed to move to the next trial.
This can be translated into a script: set $mytrial 0 ### Say I'm not allowed to continue while $mytrial == 0 ### While I'm not allowed to continue readkey 1 36000 if STATUS == WRONG ### If I'm wrong... show text "ERROR" 0 100 0 255 0 delay 1000 clear -1 fi if STATUS == CORRECT ### If I'm correct... set $mytrial 1 ### Say I'm allowed to continue show text "CORRECT" 0 100 0 255 0 delay 1000 clear -1 fi while-endIn this script, you can only move to the next trial if you answer correctly, so that you won't miss any stimulus. Let me give you a full example from the scripting tab (https://www.psytoolkit.org/doc3.2.0/syntax.html) with the script above in addition: table mytable "condition1" 255 0 0 1 ## respond with "r" to red rectangle "condition2" 0 255 0 2 ## respond with "g" to green rectangle "condition3" 0 0 255 3 ## respond with "b" to blue rectangletask mytask keys r g b table mytable set &mycounter increase set $mytrial 0 show rectangle 0 0 50 50 @2 @3 @4 show text &mycounter -200 0 0 255 0 while $mytrial == 0 readkey @5 36000 if STATUS == WRONG show text "TRY AGAIN" 0 100 0 255 0 delay 1000 clear -1 fi if STATUS == CORRECT set $mytrial 1 show text "CORRECT" 0 100 0 255 0 delay 1000 clear -1 fi while-end
block core set &mycounter 0 tasklist mytask 3 fixed endIn this script you have to press the key which corresponds to the color of the rectangle ("r" for the red rectangle, "g" for the green one and "b" for the blue one). If you press the wrong key it will show "TRY AGAIN" and will wait until you press another key. If you press the right key, you will move to the next trial.Note that:- I've added a counter (&mycounter) which is increased each time you move to the next trial (set &mycounter increase), so that you will see that you don't move to the next trial if you answer wrongly. I recommend to use such counter for debugging.
- I've only used the fixed parameter, the repeat_on_error is no longer necessary.
Hope it'll help
|
|