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_touch

options
  background color EEEEEE

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

task sce
  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 5 # this is the stimulus number on right side
  else ## left = big
    set $leftfont 3
    set $rightfont 2
    set $correctResponse 3 # this is the stimulus number on left side
  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  # 1
  show rectangle 0 0  10 100   black  # 2
  delay 500
  clear -1 -2
  font $leftfont
  show rectangle -200 0 400 400 238 238 238 # equals background color # 3
  show text $leftNumber -200 0        # 4
  font $rightfont
  show rectangle  200 0 400 400 238 238 238 # equals background color # 5
  show text $rightNumber  200 0       # 6
  readmouse l $correctResponse 3000 range 3 6 
  clear range 3 6
  #--------------------------------- response feedback
  font small
  if STATUS = CORRECT
    show text "Well done"
    delay 500
  fi
  if STATUS = WRONG
    show text "Wrong"
    font instructions
    show text "Click or tap the physically larger number" 0 100
    delay 3000
  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 "Click or tap the physically larger number" 0 100 black
  text "Click or tap here to start" 0 200  black
  wait_for_key mouse
  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   "Click or tap to continue for real block"
    wait_for_key mouse
  end

block real
  text align center
  text "The same task, but now for real" 0 -200 black
  text "Remember:" 0 -100  black
  text "Click or tap the physically larger number" 0 100 black
  text "Click or tap here to start" 0 200  black
  wait_for_key mouse
  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   "Click/tap to continue"
    wait_for_key mouse
  end