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 numerical_stroop

options
  background color EEEEEE

fonts
  instructions arial 30   # font 1
  small        arial 100  # font 2
  big          arial 120  # font 3

task sce
  keys A L
  text color black
  #------------------------ set up condition
  set $leftNumber random 1 9
  set &&a range 1 9
  set &&a remove position $leftNumber
  set $rightNumber &&a use random
  set $leftright random 1 2
  if $leftright = 1 ## left = small
    set $leftfont 2
    set $rightfont 3
    set $correctResponse 2
  else ## left = big
    set $leftfont 3
    set $rightfont 2
    set $correctResponse 1
  fi
  #----------------------- determine con/inc
  if $leftNumber < $rightNumber and $leftfont = 2
    set %conditionName "congruent"
    set $conditionNumber 1
  fi
  if $leftNumber < $rightNumber and $leftfont = 3
    set %conditionName "incongruent"
    set $conditionNumber 2
  fi
  if $leftNumber > $rightNumber and $leftfont = 2
    set %conditionName "incongruent"
    set $conditionNumber 2
  fi
  if $leftNumber > $rightNumber and $leftfont = 3
    set %conditionName "congruent"
    set $conditionNumber 1
  fi
  #--------------------------------- show stimuli
  show rectangle 0 0 100 10    black
  show rectangle 0 0  10 100   black
  delay 500
  clear -1 -2
  font $leftfont
  show text $leftNumber -200 0
  font $rightfont
  show text $rightNumber  200 0
  readkey $correctResponse 3000
  clear -1 -2
  #--------------------------------- response feedback
  font small
  if STATUS = CORRECT
    show text "Well done"
    delay 500
  fi
  if STATUS = WRONG
    show text "Wrong"
    font instructions
    show text "Press A if left number is physically larger" 0 100
    delay 1500
    show text "Press L if right number is physically larger" 0 200
    delay 2000
  fi
  if STATUS = TIMEOUT
    show text "Too slow"
    delay 1000
  fi
  clear screen
  delay 500
  save BLOCKNUMBER %conditionName $conditionNumber RT STATUS $leftNumber $rightNumber $leftfont 

block training
  text "You see two numbers, one left and one right" 0 -200 black
  text "Look which number if physically largest" 0 -100  black
  text "Press A if left number is physically larger" 0 0  black 
  text "Press L if right number is physically larger" 0 100  black
  text "Press space to start this training block" 0 200  black
  wait_for_key
  task sce 10
  feedback
    set &congruentTrials mean c4   ; select c1 == 1 && c3 == 1 && c5 == 1
    set &incongruentTrials mean c4 ; select c1 == 1 && c3 == 2 && c5 == 1
    text color black
    text align left
    text -390 -200 &congruentTrials ; prefix "Congruent" ; postfix "ms"
    text -390 -100 &incongruentTrials ; prefix "Incongruent" ; postfix "ms"
    text -390  0   "Press space to continue for real block"
  end

block real
  text align center
  text "The same task, but now for real" 0 -200 black
  text "Remember:" 0 -100  black
  text "Press A if left number is physically larger" 0 0  black 
  text "Press L if right number is physically larger" 0 100  black
  text "Press space to start" 0 200  black
  wait_for_key
  task sce 40
  feedback
    set &congruentTrials mean c4   ; select c1 == 2 && c3 == 1 && c5 == 1
    set &incongruentTrials mean c4 ; select c1 == 2 && c3 == 2 && c5 == 1
    text color black
    text align left
    text -390 -200 &congruentTrials ; prefix "Congruent" ; postfix "ms"
    text -390 -100 &incongruentTrials ; prefix "Incongruent" ; postfix "ms"
    text -390  0   "Press space to continue"
  end