How to use
This is the main source code for the experiment. If you want to use it, you should copy the actual zip file to your own PsyToolkit account, because often there are other files included for stimuli.
The source code for stroop_en
options
background color grey
# table columns:
# 1) The word as shown on screen. You can change this to different languages
# 2) We use a number for colors, 1=red, 2=green, 3=blue, 4=white
# 3) 1=congruent (word meaning matches color). 2=incongruent (no match)
#
# NOTE: the textcolor (column 2) is the same as the required key
table stroop
"RED" 1 1 ## red congruent
"RED" 1 2 ## red incongruent
"GREEN" 2 1 ## green congruent
"GREEN" 2 2 ## green incongruent
"BLUE" 3 1 ## blue
"BLUE" 3 2 ## blue
"YELLOW" 4 1 ## yellow
"YELLOW" 4 2 ## yellow
fonts
normal arial 20
big arial 80
part what_should_be_pressed
font normal
if &textcolor == 1
show text "You should have pressed the R key" 0 100
show text "because the ink color of the word was RED" 0 150
fi
if &textcolor == 2
show text "You should have pressed the G key" 0 100
show text "because the ink colour of the word was GREEN" 0 150
fi
if &textcolor == 3
show text "You should have pressed the B key" 0 100
show text "because the ink colour of the word was BLUE" 0 150
fi
if &textcolor == 4
show text "You should have pressed the Y key" 0 100
show text "because the ink colour of the word was YELLOW" 0 150
fi
task stroop
keys r g b y ## you can change this to different buttons depending on language
delay 500
show rectangle 0 0 10 30 ## part of fixation point
show rectangle 0 0 30 10 ## part of fixation point
delay 200
clear 1 2
# ------------------------------------------------------
# if it is congruent, textcolor is same as textname
if @3 == 1
set &textcolor @2
else
# if it is incongruent, textcolor is different
# choose a random textcolor other than @2 (its own color)
set &&colorrange 1 2 3 4
set &&colorrange remove position @2
set &textcolor &&colorrange use random
fi
#
font big
if &textcolor == 1
show text @1 0 0 red
fi
if &textcolor == 2
show text @1 0 0 green
fi
if &textcolor == 3
show text @1 0 0 blue
fi
if &textcolor == 4
show text @1 0 0 yellow
fi
## the 5000 is the maximum time
readkey &textcolor 5000
clear -1
if STATUS == CORRECT
show text "Correct"
delay 500
clear -1
fi
if STATUS == WRONG
show text "Wrong key"
part what_should_be_pressed
delay 5000
clear screen
fi
if STATUS == TIMEOUT
show text "Too slow"
part what_should_be_pressed
delay 5000
clear screen
fi
delay 500
save BLOCKNUMBER RT STATUS @1 @2 @3 &textcolor
task instruction
keys space
font normal
text align left
show text "In this task, do the following." -300 -250
show text "Respond with the keys R, G, B, or Y" -300 -200
show text "to the ink (font) color of the words." -300 -150
show text "Respond to words in a RED font with the R" -300 -100
show text "Respond to words in a GREEN font with the G" -300 -50
show text "Respond to words in a BLUE font with the B" -300 0
show text "Respond to words in a YELLOW font with the Y" -300 50
show text "Press SPACE to continue" -300 150 yellow
readkey 1 99999
clear screen
show text "Thus:" -300 -250
show text "If you see the word" -300 -200
show text "RED" -300 -150 green
show text "you press the key G" -300 -100
show text "because the ink (font) color of the letters is GREEN." -300 -50
show text "Even when the meaning of the word says something else," -300 0
show text "you still need to respond to the color of the letters." -300 50
show text "Press space bar to try yourself" -300 200 yellow
readkey 1 99999
block instruction ## this is block number 1
message "STROOP task, press the SPACE bar to start"
task instruction 1
block training ## this is block number 2
message "Now try this yourself."
task stroop 8
block real ## this is block number 3
message "Now that you are trained, real data collection begins"
task stroop 80 ## 8 * 5
message "Well done"
feedback
text -350 0 "Your speed in correct trials"
set &StroopCon mean c2 ; select c1 == 3 && c6 == 1 && c3 == 1
set &StroopInc mean c2 ; select c1 == 3 && c6 == 2 && c3 == 1
set &StroopEffect expression &StroopInc - &StroopCon
text -350 50 &StroopCon ; prefix "congruent: " ; postfix " ms"
text -350 100 &StroopInc ; prefix "incongruent: " ; postfix " ms"
text -350 150 &StroopEffect ; prefix "Your Stroop effect is incongruent minus congruent: " ; postfix " ms"
text -350 200 "Press space key to end"
end