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 taskswitching_cued
options
bitmapdir stimuli
set &CurrentTask 0
set &previousTask 0
set &cue_display_time 350
set &cue_delay 750
set &intertrialinterval 1000
fonts
arial 18
bitmaps
ready
fixpoint
thankyou
info1
instruction1
instruction2
instruction3
instruction4
wrong_key
too_slow
circle_blue
circle_yellow
rectangle_blue
rectangle_yellow
colorcue
shapecue
######################################################################
# task switching conditions
######################################################################
table colortasktable
"color congruent 1 left " circle_yellow 1
"color incongruent 2 left " rectangle_yellow 1
"color incongruent 2 right" circle_blue 2
"color congruent 1 right" rectangle_blue 2
table shapetasktable
"shape congruent 1 left " circle_yellow 1
"shape incongruent 2 right" rectangle_yellow 2
"shape incongruent 2 left " circle_blue 1
"shape congruent 1 right" rectangle_blue 2
######################################################################
# task switching tasks
######################################################################
task color
table colortasktable
keys b n
# -- for later data analysis --------
set &CurrentTask 1
if &CurrentTask == &previousTask
set $taskSwitch 1
fi
if &CurrentTask != &previousTask
set $taskSwitch 2
fi
set &previousTask &CurrentTask
#------------------------------------
show bitmap fixpoint
delay 150
clear -1
delay 500
show bitmap colorcue
delay &cue_display_time
clear -1
delay &cue_delay
show bitmap @2
readkey @3 2000 ## respond withint 2s
clear -1
if STATUS == WRONG
show bitmap wrong_key
delay 500
clear -1
fi
if STATUS == TIMEOUT
show bitmap too_slow
delay 500
clear -1
fi
delay &intertrialinterval
save BLOCKNAME @1 RT STATUS $taskSwitch
task shape
table shapetasktable
keys b n
# -- for later data analysis --------
set &CurrentTask 2
if &CurrentTask == &previousTask
set $taskSwitch 1
fi
if &CurrentTask != &previousTask
set $taskSwitch 2
fi
set &previousTask &CurrentTask
#------------------------------------
show bitmap fixpoint
delay 150
clear -1
delay 500
show bitmap shapecue
delay &cue_display_time
clear -1
delay &cue_delay
show bitmap @2
readkey @3 2000 ## responde withint 2s
clear -1
if STATUS == WRONG
show bitmap wrong_key
delay 500
clear -1
fi
if STATUS == TIMEOUT
show bitmap too_slow
delay 500
clear -1
fi
delay &intertrialinterval
save BLOCKNAME @1 RT STATUS $taskSwitch
# -------------------------------------------------------
# B L O C K S
# -------------------------------------------------------
######################################################################
# B L O C K S
######################################################################
block trainingblock
pager info1 instruction1 instruction2 instruction3 instruction4
tasklist
color 5
shape 5
end
block realblock
message ready
tasklist
color 25
shape 25
end
feedback
set &overall mean c6 ; select c7 == 1
set &RepeatTrials mean c6 ; select c7 == 1 && c8 == 1
set &SwitchTrials mean c6 ; select c7 == 1 && c8 == 2
set &Congruent mean c6 ; select c7 == 1 && c4 == 1
set &Incongruent mean c6 ; select c7 == 1 && c4 == 2
set &SwitchCost expression &SwitchTrials - &RepeatTrials
set &TaskInterference expression &Incongruent - &Congruent
text 0 -200 &overall ; prefix "Average RT in all correct trials:" ; postfix "ms"
text 0 -150 &RepeatTrials ; prefix "RT in task-repeat trials:" ; postfix "ms"
text 0 -100 &SwitchTrials ; prefix "RT in task-switching trials:" ; postfix "ms"
text 0 -50 &SwitchCost ; prefix "Task-switch cost:" ; postfix "ms"
text 0 0 &Congruent ; prefix "RT in task-congruent trials:" ; postfix "ms"
text 0 50 &Incongruent ; prefix "RT in task-incongruent trials:" ; postfix "ms"
text 0 100 &TaskInterference ; prefix "Task-interference:" ; postfix "ms"
text 0 250 "Press space bar"
end
##########################
message thankyou