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 flanker

options
  bitmapdir stimuli

bitmaps
  fix
  fixgreen
  fixred
  intro

fonts
  Small arial 18
  Large arial 40

table flankers
 "XXXXX" 1 1
 "XXCXX" 1 1
 "XXVXX" 0 2
 "XXBXX" 0 2
 "CCXCC" 1 1
 "CCCCC" 1 1
 "CCVCC" 0 2
 "CCBCC" 0 2
 "VVXVV" 0 1
 "VVCVV" 0 1
 "VVVVV" 1 2
 "VVBVV" 1 2
 "BBXBB" 0 1
 "BBCBB" 0 1
 "BBVBB" 1 2
 "BBBBB" 1 2

task flanker
  table flankers
  keys a l
  font Large
  show bitmap fix 0 25 # stimulus 1
  show text @1 0 -25 255 255 255 # stimulus 2
  readkey @3 2000
  if STATUS = CORRECT
    clear 1 2
    show bitmap fixgreen 0 25
    delay 150
    clear 3
    delay 150
    show bitmap fixgreen 0 25
    delay 150
    clear 4
 fi
 if STATUS = WRONG
    clear 1 2
    font Small
    show text "You pressed the wrong key." 0 -150 # stimulus 3 
    show text "If you see X or C in the middle, press the A key" 0 -100 # stimulus 3 
    show text "If you see V or B in the middle, press the L key" 0 -50 # stimulus 4
    set $counter 0
    while $counter < 15
      set $counter increase
      show bitmap fixred 0 25
      delay 100
      clear -1
      delay 100
    while-end
    clear 3 4 5 # clear the reminder
 fi
 if STATUS = TIMEOUT
    clear 1 2
    font Small
    show text "You responded to slowly. Respond within 2 seconds." 0 -150 # stimulus 3 
    show text "If you see X or C in the middle, press the A key" 0 -100 # stimulus 4
    show text "If you see V or B in the middle, press the L key" 0 -50 # stimulus 5
    set $counter 0
    while $counter < 15
      set $counter increase
      show bitmap fixred 0 25
      delay 100
      clear -1
      delay 100
    while-end
    clear 3 4 5 # clear the reminder
 fi
 delay 500 # intertrial interval
 save @1 @2 STATUS RT

message intro

block test
  task flanker 50
  feedback
    text align left
    text color yellow    
    set &RTCon mean c4 ; select c2 == 1 && c3 == 1 
    set &RTInc mean c4 ; select c2 == 0 && c3 == 1
    set &FlankerEffect expression &RTInc - &RTCon
    text -200 -100 "Average RT in conditions:"
    text -200  -25 &RTCon ; prefix "Compatible: "     ; postfix " ms"
    text -200   50 &RTInc ; prefix "Incompatible: "   ; postfix " ms"
    text -200  125 &FlankerEffect ; prefix "Flanker effect: " ; postfix " ms"
    text -200  200 "Press space bar to continue"
  end