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 mackworth
options
fullscreen
bitmaps
instruction
clock_circle
clock_hand
fonts
arial 18
task vigilance
keys space
## -- update hand location (steps of 3.6 degrees)
## note: a skip does never repeat
set &randomnumber random 1 10
set &hand_position increase 36
if &randomnumber == 10 && &skipped == 0
set &hand_position increase 36 ## increase a bit more 1 in 10 times
set &skipped 1 ## skipped is 1 when previous trial was a skip
fi
if &randomnumber < 10
set &skipped 0
fi
if &hand_position >= 3600
set &hand_position 0
fi
## -- now draw clock
draw off
show bitmap clock_circle
rotate next &hand_position
show bitmap clock_hand 0 0
if &missed_detection == 1 ## of previous trial, show feedback now
show circle 0 0 30 255 0 0 ## negative feedback (should have pressed in previous trial)
set &missed_detection 0
fi
draw on
## -- now wait for key press (often people should not respond
readkey 1 1000
if RT < 1000
if &randomnumber == 10
show circle 0 0 30 0 255 0 ## positive feedback
set $correct_detection 1
fi
if &randomnumber < 10
show circle 0 0 30 255 0 0 ## negative feedback (should not have pressed)
set $incorrect_detection 1
fi
set $resttime expression 1000 - RT
delay $resttime
fi
if STATUS == TIMEOUT && &randomnumber == 10
set &missed_detection 1 ## show error message in next trial
fi
## -- save data
save RT STATUS &hand_position &randomnumber $correct_detection $incorrect_detection &missed_detection
block test
message instruction
maxtime 5m
tasklist
vigilance 999999
end
feedback
set &total_ticks count ; select c4 > 0
set &missed_ticks count ; select c7 == 1
set &wrong_ticks count ; select c6 == 1
text align left
text color yellow
text -290 -200 "Feedback about your vigilance"
text color white
text -290 -100 &total_ticks ; prefix "Total ticks: "
text -290 0 &missed_ticks ; prefix "Missed skips: "
text -290 100 &wrong_ticks ; prefix "Wrongly detected skips: "
end