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 ax-cpt

## AX-CPT
## there are 4 types of trials
## AX : m after cue "a" and "c" after probe "x"
## BX : any letter except A followed by x (press m m)
## AY : A followed by any except X (press m m)
## BY : any pair except A and X (press m m)

bitmaps
  instructions1
  instructions2

fonts
  regularfont arial 20
  letterFont courier 60

## this table sets the frequency. A common setup is to have 70% AX trials, and 10% for other trial types

table conditions
  "AX" 2 # only in AX trials, the second letter is the c, which is the second letter in the keys line below
  "AX" 2
  "AX" 2
  "AX" 2
  "AX" 2
  "AX" 2
  "AX" 2
  "BX" 1 # in other trials, the second letter is letter 1 (the m)
  "BY" 1
  "AY" 1

part countDownToContinue
  font regularfont # makes next show text large
  show rectangle 0 0 800 500 yellow
  show text %feedback1 0 -50 black
  show text %feedback2 0 0 black
  show text %feedback3 0 50 black
  set $delayCounterInterval 500
  set $countDown 20
  while $countDown > 0
    show text $countDown 0 100   black
    delay $delayCounterInterval
    clear -1
    set $countDown decrease
  while-end
  show text "Concentrate. Press a key to continue with the task" 0 200 black
  readkey 3 99999

task axcpt
  keys m c space
  # note, we excluded C and M because they are used for the keys, and we excluded K as in original study
  set %%otherLetters "B" "D" "E" "F" "G" "H" "I" "J" "L" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "Y" "Z"
  set %feedback1 " "
  set %feedback2 " "
  set %feedback3 " "
  # -- first select letters
  if @1 = "AX"
    set %letter1 "A"
    set %letter2 "X"
    set %feedback2 "If you see a blue A followed by a white X"
    set %feedback3 "then press C"
  fi
  if @1 = "AY"
    set %letter1 "A"
    set %letter2 %%otherLetters use random
    set %feedback2 "If you see a blue A followed by a letter other than X"
    set %feedback3 "then press M"
  fi
  if @1 = "BX"
    set %letter1 %%otherLetters use random
    set %letter2 "X"
    set %feedback2 "If you see a blue letter that is not an A"
    set %feedback3 "followed by an X, then press M"
  fi
  if @1 = "BY"
    set %letter1 %%otherLetters use random
    set %%tmpLetters %%otherLetters # make copy of otherLetters
    set %%tmpLetters remove value %letter1 # this prevents repeat of same letter in BY trials
    set %letter2 %%tmpLetters use random
    set %feedback2 "If you see a blue letter that is not an A"
    set %feedback3 "followed by a letter other than X, then press M"
  fi
  ## -- now show fixpoint made from two rectangles
  show rectangle 0 0 5  30 white
  show rectangle 0 0 30 5 white
  delay 200
  clear -1 -2
  font letterFont # makes next show text large
  show text %letter1  0 0    0 255 255 # 0,255,255 is cyan
  readkey 1 500 # response window 1: 500ms with cue; always need to press m to first cue letter
  if STATUS = TIMEOUT # it can be timeout, because this is first part of response window (with letter present)
    clear -1
    show rectangle 0 0 5 30 white
    show rectangle 0 0 30 5 white
    readkey 1 500 # response window 2 for the cue, but now the cue not shown
    clear -1 -2 # remove fixpoint that was shown during second part of response window
    set $rt1 expression 500 + RT
  else
    clear -1
    set $rt1 RT
  fi
  set $status1 STATUS
  if STATUS = WRONG # if people pressed C instead of M to the cue
    set %feedback1 "If you see a blue letter, you always need"
    set %feedback2 "to press the letter M on the keyboard"
    set %feedback3 " "
    part countDownToContinue # note that call also changes STATUS
  fi
  if STATUS = TIMEOUT
    set %feedback1 "You failed to respond to the blue letter WITHIN 1 second."
    set %feedback2 "If you see any blue letter,"
    set %feedback3 "always press the letter M on the keyboard."
    part countDownToContinue # note that call also changes STATUS
  fi
  #
  #-- first part done
  #
  if $status1 = CORRECT # we only continue if response to cue was correct
    # -------------------------------------------------------------------------
    # In this case, trial continues with further wait and second letter
    # -------------------------------------------------------------------------
    show rectangle 0 0 5  30 white # fixpoint
    show rectangle 0 0 30 5 white  # fixpoint
    delay 3900
    clear -1 -2
    ## -- now show for the second letter and wait 1000 ms for response
    show text %letter2
    readkey @2 1000
    clear -1
    if STATUS = TIMEOUT
      set %feedback1 "You responded to the blue letter, but not to the white letter."
      part countDownToContinue
    fi
    if STATUS = WRONG
      set %feedback1 "You responded correctly to the blue letter, but not to the white one."
      part countDownToContinue
    fi
    set $rt2 RT
    set $status2 STATUS
  fi
  clear screen
  delay 1000 ## added some break
  #--so far, we had responses for part of the trials
  #  good to have complete status
  #  here 1 means correct, 0 means wrong
  if $status1 = 1 and $status2 = 1
    set $trialstatus 1
    set &correctInRowCounter increase # count up to 10 for practiseblock
  else
    set &correctInRowCounter 0
  fi
  save BLOCKNAME $trialstatus %letter1 %letter2 $rt1 $status1 $rt2 $status2 &correctInRowCounter
  if &practiseMode = 1 and &correctInRowCounter >= 10
    end tasklist # this ends practise block after 10 trials correct in a row
  fi

block training
  set &practiseMode 1
  message instructions1
  task axcpt 50 # runs up to 50

block realdata
  set &practiseMode 0
  message instructions2
  task axcpt 150