---
API: 2.1
OpenSesame: 3.3.9
Platform: nt
---
set width 852
set uniform_coordinates yes
set title "Extended template"
set subject_parity even
set subject_nr 0
set start experiment
set sound_sample_size -16
set sound_freq 48000
set sound_channels 2
set sound_buf_size 1024
set sampler_backend legacy
set round_decimals 2
set mouse_backend xpyriment
set keyboard_backend legacy
set height 480
set fullscreen no
set form_clicks no
set foreground white
set font_underline no
set font_size 24
set font_italic no
set font_family "Times New Roman"
set font_bold no
set experiment_path "D:/Dropbox/Work backup/fab/exp2020-2021/Open Sesame pointers and help/Task examples/Adaptasi Conners CPT"
set disable_garbage_collection yes
set description "A template containing a practice and an experimental phase"
set coordinates uniform
set compensation 0
set color_backend legacy
set clock_backend legacy
set canvas_backend xpyriment
set bidi yes
set background black
define keyboard_response R1_response
set timeout "[targeton]"
set flush yes
set event_type keypress
set duration keypress
set description "Collects keyboard responses"
set allowed_responses SPACE
define keyboard_response R2_response
set timeout "[r2timeout]"
set flush yes
set event_type keypress
set duration keypress
set description "Collects keyboard responses"
set allowed_responses SPACE
define sketchpad Target
set start_response_interval 2000
set duration 0
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=48 html=yes show_if=always text="[target]" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="TARGET
BLOCK:[block_id] SUB-BLOCK:[subblock] ISI:[trial_duration]
(displayed for [targeton] ms)" x=0 y=-192 z_index=0
define sketchpad Transition
set duration 0
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="TRANSITION
BLOCK:[block_id] SUB-BLOCK:[subblock] ISI:[trial_duration]
Displayed for [r2timeout] ms" x=0 y=-192 z_index=0
define loop block_loop
set source table
set skip 0
set repeat 0.25
set order random
set offset no
set item trial_sequence
set description "A single block of trials"
set cycles 28
set continuous no
set column_order ""
set break_if_on_first yes
set break_if never
setcycle 0 correct_response space
setcycle 0 target A
setcycle 1 correct_response space
setcycle 1 target B
setcycle 2 correct_response space
setcycle 2 target C
setcycle 3 correct_response space
setcycle 3 target D
setcycle 4 correct_response space
setcycle 4 target E
setcycle 5 correct_response space
setcycle 5 target F
setcycle 6 correct_response space
setcycle 6 target G
setcycle 7 correct_response space
setcycle 7 target H
setcycle 8 correct_response space
setcycle 8 target I
setcycle 9 correct_response space
setcycle 9 target J
setcycle 10 correct_response space
setcycle 10 target K
setcycle 11 correct_response space
setcycle 11 target L
setcycle 12 correct_response space
setcycle 12 target M
setcycle 13 correct_response space
setcycle 13 target N
setcycle 14 correct_response space
setcycle 14 target O
setcycle 15 correct_response space
setcycle 15 target P
setcycle 16 correct_response space
setcycle 16 target Q
setcycle 17 correct_response space
setcycle 17 target R
setcycle 18 correct_response space
setcycle 18 target S
setcycle 19 correct_response space
setcycle 19 target T
setcycle 20 correct_response space
setcycle 20 target U
setcycle 21 correct_response space
setcycle 21 target V
setcycle 22 correct_response space
setcycle 22 target W
setcycle 23 correct_response None
setcycle 23 target X
setcycle 24 correct_response None
setcycle 24 target X
setcycle 25 correct_response None
setcycle 25 target X
setcycle 26 correct_response space
setcycle 26 target Y
setcycle 27 correct_response space
setcycle 27 target Z
run trial_sequence
define sequence block_sequence
set flush_keyboard yes
set description "A sequence containing a single block of trials followed by feedback to the participant"
run reset_feedbackvariables always
run block_loop always
run calculate_feedback always
run feedback always
define loop blocks
set source table
set skip 0
set repeat 1
set order sequential
set offset no
set item block_sequence
set description "A loop containing one or more experimental blocks"
set cycles 6
set continuous no
set column_order practice
set break_if_on_first yes
set break_if never
setcycle 0 practice no
setcycle 0 block_id A
setcycle 0 SB1_ISI 1000
setcycle 0 SB2_ISI 2000
setcycle 0 SB3_ISI 4000
setcycle 1 practice no
setcycle 1 block_id B
setcycle 1 SB1_ISI 1000
setcycle 1 SB2_ISI 4000
setcycle 1 SB3_ISI 2000
setcycle 2 practice no
setcycle 2 block_id C
setcycle 2 SB1_ISI 2000
setcycle 2 SB2_ISI 1000
setcycle 2 SB3_ISI 4000
setcycle 3 practice no
setcycle 3 block_id D
setcycle 3 SB1_ISI 2000
setcycle 3 SB2_ISI 4000
setcycle 3 SB3_ISI 1000
setcycle 4 practice no
setcycle 4 block_id E
setcycle 4 SB1_ISI 4000
setcycle 4 SB2_ISI 1000
setcycle 4 SB3_ISI 2000
setcycle 5 practice no
setcycle 5 block_id F
setcycle 5 SB1_ISI 4000
setcycle 5 SB2_ISI 2000
setcycle 5 SB3_ISI 1000
run blocks_sequence
define sequence blocks_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run subblocks always
define inline_javascript calculate_feedback
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// calcultes block-wise performance
vars.acc=roundToTwo(100*vars.correct_count/vars.response_count)
vars.avg_rt=roundToTwo(vars.sumrt/vars.response_count)
// Declares rounding function to be used for calculating block performance (for feedback display)
// Rounding to 2 decimals
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2")
}
__end__
set _prepare ""
define sketchpad end_of_experiment
set start_response_interval no
set duration keypress
set description "A sketchpad notifying the participant that the experiment is finished"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="Tes Telah Selesai" x=0 y=-192 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=24 html=yes show_if=always text="Tes ini telah selesai.
Terima kasih atas partisipasi anda.
Semoga partisipasi ini bermanfaat bagi anda." x=0 y=-64 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Silahkan tekan tombol Enter untuk mengakhiri tes" x=0 y=192 z_index=0
define sketchpad end_of_practice
set start_response_interval no
set duration keypress
set description "A sketchpad notifying the participant that the practice phase is finished"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=24 html=yes show_if=always text="Fase tutorial telah selesai
" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Tekan tombol Enter untuk melanjutkan" x=0 y=192 z_index=0
define sequence experiment
set flush_keyboard yes
set description "The main sequence of the experiment"
run setup_timings always
run title always
run instruction always
run tutorial always
run practice_loop always
run end_of_practice always
run experimental_instruction always
run blocks always
run end_of_experiment always
define sketchpad experimental_instruction
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="Silahkan tekan tombol Enter untuk memulai tes yang sesungguhnya
" x=0 y=192 z_index=0
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=32 html=yes show_if=always text="Adaptasi Conners Continuous Performance Test" x=0 y=-192 z_index=0
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="Setelah ini anda akan mengerjakan tes yang sesungguhnya.
Instruksi yang harus diingat kembali adalah:" x=32 y=-96 z_index=0
draw textline center=0 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="1. Tekan tombol Spasi ketika huruf yang muncul adalah huruf SELAIN X.
2. JANGAN tekan tombol Spasi ketika huruf yang muncul adalah huruf X.
3. Respon secepat dan setepat mungkin." x=-352 y=-64 z_index=0
define feedback feedback
set reset_variables yes
set duration keypress
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=24 html=yes show_if=always text="Rata-rata waktu reaksi anda: [avg_rt]ms
Akurasi anda: [acc]%" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Tekan tombol Enter untuk melanjutkan" x=0 y=160 z_index=0
define feedback feedback_ex
set reset_variables yes
set duration keypress
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Rata-rata waktu reaksi anda: [avg_rt] ms
Akurasi anda: [acc]%" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Silahkan tekan tombol Enter untuk melanjutkan" x=0 y=160 z_index=0
define loop ind_subblock
set source table
set skip 0
set repeat 0.25
set order random
set offset no
set item trial_sequence
set description "A single block of trials"
set cycles 28
set continuous no
set column_order ""
set break_if_on_first yes
set break_if never
setcycle 0 correct_response space
setcycle 0 target A
setcycle 1 correct_response space
setcycle 1 target B
setcycle 2 correct_response space
setcycle 2 target C
setcycle 3 correct_response space
setcycle 3 target D
setcycle 4 correct_response space
setcycle 4 target E
setcycle 5 correct_response space
setcycle 5 target F
setcycle 6 correct_response space
setcycle 6 target G
setcycle 7 correct_response space
setcycle 7 target H
setcycle 8 correct_response space
setcycle 8 target I
setcycle 9 correct_response space
setcycle 9 target J
setcycle 10 correct_response space
setcycle 10 target K
setcycle 11 correct_response space
setcycle 11 target L
setcycle 12 correct_response space
setcycle 12 target M
setcycle 13 correct_response space
setcycle 13 target N
setcycle 14 correct_response space
setcycle 14 target O
setcycle 15 correct_response space
setcycle 15 target P
setcycle 16 correct_response space
setcycle 16 target Q
setcycle 17 correct_response space
setcycle 17 target R
setcycle 18 correct_response space
setcycle 18 target S
setcycle 19 correct_response space
setcycle 19 target T
setcycle 20 correct_response space
setcycle 20 target U
setcycle 21 correct_response space
setcycle 21 target V
setcycle 22 correct_response space
setcycle 22 target W
setcycle 23 correct_response None
setcycle 23 target X
setcycle 24 correct_response None
setcycle 24 target X
setcycle 25 correct_response None
setcycle 25 target X
setcycle 26 correct_response space
setcycle 26 target Y
setcycle 27 correct_response space
setcycle 27 target Z
run trial_sequence
define sequence ind_subblock_sequence
set flush_keyboard yes
set description "A sequence containing a single block of trials followed by feedback to the participant"
run reset_feedbackvariables always
run setup_subblock_ISI always
run ind_subblock always
run calculate_feedback always
run feedback_ex always
define sketchpad instruction
set start_response_interval no
set duration keypress
set description "A sketchpad containing the instructions for the participant"
draw textline center=1 color=white font_bold=yes font_family=mono font_italic=no font_size=24 html=yes show_if=always text="Instruksi Pengerjaan Tes" x=0 y=-192 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=no show_if=always text="" x=0 y=-128 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Dalam tes ini anda akan melihat huruf-huruf yang muncul selama 14 menit. Anda diminta untuk merespon huruf yang muncul dengan cepat dan tepat.
Terdapat 2 respon yang tepat dalam tes ini, yaitu:
1. Tekan tombol Spasi ketika huruf yang muncul adalah huruf SELAIN X.
2. JANGAN tekan tombol Spasi ketika huruf yang muncul adalah huruf X." x=0 y=-32 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Tekan tombol Enter untuk melanjutkan" x=0 y=192 z_index=0
define logger logger
set description "Logs experimental data"
set auto_log no
log block_id
log correct
log correct_R1_response
log correct_R2_response
log count_blocks
log practice
log response
log response_R1_response
log response_R2_response
log response_time
log response_time_R1_response
log response_time_R2_response
log subblock
log target
log time_R1_response
log time_R2_response
log time_Target
log time_Transition
log time_logger
define inline_javascript monitoring_R1
set description "Executes JavaScript code (ECMA 5.1)"
___run__
console.log ("____________________________________")
console.log ("TARGET: "+vars.target)
console.log("R1_Correct_response:"+vars.correct_response+" R1_Response:"+vars.response+ " R1 RT:"+vars.response_time+ " OSAvgAcc:"+vars.acc+" OSAvgRT:"+vars.avg_rt)
vars.respR1=vars.response
vars.respR1RT=vars.response_time
// Detecting whether or not a R1 response has been detected
// in order later to be able to add the duration of the target presentation to the R2 response time if no R1 has been detected (see "Run if" property of trial_sequence)
if (vars.response == "None") {
vars.collectedR1="no"
// insert here code to avoid the task including R1 in calculation of block-wise performance feedback
// ??
} else {
vars.collectedR1="yes"
}
console.log ("collectedR1:"+vars.collectedR1)
__end__
set _prepare ""
define inline_javascript monitoring_R2
set description "Executes JavaScript code (ECMA 5.1)"
___run__
console.log("R2_Correct_response:"+vars.correct_response+" R2_Response:"+vars.response+ " R2 RT:"+vars.response_time+" OSAvgAcc:"+vars.acc+" OSAvgRT:"+vars.avg_rt)
vars.respR2=vars.response
vars.respR2RT=vars.response_time
// Detecting whether or not a R1 response has been detected
// in order later to be able to add the duration of the target presentation to the R2 response time if no R1 has been detected (see "Run if" property of trial_sequence)
if (vars.response == "None") {
vars.collectedR2="no"
} else {
vars.collectedR2="yes"
}
__end__
set _prepare ""
define inline_javascript monitoring_R2b
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// simply displays in the console whether Rw was collected
console.log ("collectedR2:"+vars.collectedR2)
__end__
set _prepare ""
define inline_javascript performance_calculation
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// stores performance in block performance
vars.response_count=vars.response_count+1
vars.sumrt=vars.sumrt+vars.response_time
if (vars.correct==1){
vars.correct_count=vars.correct_count+1
}
if (vars.collectedR1=="no" && vars.collectedR2=="no") {
vars.omissions_count=vars.omissions_count+1
}
// outputs trial performance to console:
console.log ("Block:"+vars.block_id+" > Sub-block:"+vars.subblock+" (ISI="+vars.trial_duration+")")
console.log ("Info for whole trial: Resp:"+vars.response+" Correct:"+vars.correct_response+" Acc:"+vars.correct+" RT:"+vars.response_time)
console.log ("Counters: [ResponseCount="+vars.response_count+"] [CorrectCount="+vars.correct_count+"] OmissionsCount=["+vars.omissions_count+ "] [SumRT="+vars.sumrt+"]")
console.log ("____________________________________")
__end__
set _prepare ""
define feedback postR2_interval
set reset_variables no
set duration "[postR2_duration]"
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="TRANSITION
BLOCK:[block_id] SUB-BLOCK:[subblock] ISI:[trial_duration]
Displayed for [r2timeout] ms" x=0 y=-192 z_index=0
define feedback postrR1_interval
set reset_variables no
set duration "[postR1_duration]"
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=48 html=yes show_if=always text="[target]" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="TARGET
BLOCK:[block_id] SUB-BLOCK:[subblock] ISI:[trial_duration]
(displayed for [targeton] ms)" x=0 y=-192 z_index=0
define loop practice_loop
set source table
set skip 0
set repeat 1
set order random
set offset no
set item block_sequence
set description "A loop containing one or more practice blocks"
set cycles 1
set continuous no
set column_order practice
set break_if_on_first yes
set break_if never
setcycle 0 practice yes
setcycle 0 block_id practice
setcycle 0 subblock practice
run block_sequence
define inline_javascript reset_feedbackvariables
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// resets bespoke feedback variables
vars.response_count=0
vars.sumrt=0
vars.omissions_count=0
vars.correct_count=0
__end__
set _prepare ""
define inline_javascript resets_rmonitoring
set description "Executes JavaScript code (ECMA 5.1)"
___run__
vars.collectedR1="no"
vars.collectedR2="no"
__end__
set _prepare ""
define inline_javascript setup_postR1_duration
set description "Executes JavaScript code (ECMA 5.1)"
___run__
vars.postR1_duration = vars.targeton - vars.response_time
if (vars.postR1_duration < 0){
vars.postR1_duration = 0
}
__end__
set _prepare ""
define inline_javascript setup_post_duration
set description "Executes JavaScript code (ECMA 5.1)"
___run__
if (vars.collectedR1 == "no") {
vars.postR2_duration = vars.r2timeout - vars.response_time
} else {
vars.postR2_duration = vars.r2timeout
}
if (vars.postR2_duration < 0){
vars.postR2_duration = 0
}
__end__
set _prepare ""
define inline_javascript setup_subblock_ISI
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// setsup the appropriate ISI value for this subblock
if (vars.subblock == "1") {
vars.trial_duration=vars.SB1_ISI
}
if (vars.subblock == "2") {
vars.trial_duration=vars.SB2_ISI
}
if (vars.subblock == "3") {
vars.trial_duration=vars.SB3_ISI
}
vars.r2timeout = vars.trial_duration-vars.targeton
__end__
set _prepare ""
define inline_javascript setup_timings
set description "Executes JavaScript code (ECMA 5.1)"
set _run ""
___prepare__
// program modified by @Fab
// https://forum.cogsci.nl/discussion/7099/how-can-i-make-a-continuous-performance-test-without-coroutines
// sets up time during which the target must be on screen
vars.targeton = 495
// sets up total duration of trial
vars.trial_duration = 2000
// sets up max duration of Response 2
vars.r2timeout = vars.trial_duration-vars.targeton
__end__
define loop subblocks
set source table
set repeat 1
set order sequential
set description "Repeatedly runs another item"
set cycles 3
set continuous no
set break_if_on_first yes
set break_if never
setcycle 0 subblock 1
setcycle 1 subblock 2
setcycle 2 subblock 3
run ind_subblock_sequence
define sketchpad title
set duration 2000
set description ""
draw textline center=1 color=white font_bold=yes font_family="Times New Roman" font_italic=no font_size=27 html=yes show_if=always text="Adaptasi Conners Continuous Performance Test" x=0 y=0 z_index=0
define sequence trial_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run resets_rmonitoring always
run Target always
run R1_response always
run setup_postR1_duration always
run monitoring_R1 always
run postrR1_interval "[response]!=None"
run Transition always
run R2_response "[response]=None"
run setup_post_duration always
run monitoring_R2 "[collectedR1]=no"
run monitoring_R2b always
run updating_RT always
run performance_calculation always
run postR2_interval always
run logger always
define sketchpad tutorial
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family="Times New Roman" font_italic=no font_size=24 html=yes show_if=always text="Sebelum memulai tes yang sesungguhnya
silahkan kerjakan tutorial berikut" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Tekan tombol Enter untuk melanjutkan" x=0 y=192 z_index=0
define inline_javascript updating_RT
set description "Executes JavaScript code (ECMA 5.1)"
___run__
// Update response time on the fly
// R2 will only run if no R1 was collected
// Hence RT is measured from the onset of R2 but the participant is responding to the appearance of the target.
// Therefore we have to add the duration of the presentation of the target [targeton] to the RT collected from R2
// IF AND ONLY IF a response R1 was NOT registered
if (vars.collectedR1 == "no") {
vars.response_time = vars.response_time+vars.targeton
}
__end__
set _prepare ""