Trouble with data output


Author
Message
Inneedofcodinghelp
Inneedofcodinghelp
Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)
Group: Forum Members
Posts: 2, Visits: 6
Hi Team,
I have been attempting to reverse engineer the below syntax from the test library:

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************



This is my current syntax











**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=white,2=middleeastern)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 middleeastern cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 10
/ iti = 10
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = fixation
/ targettype:    0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    count
s all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_target_gotarget:   counts all trials in which cue = fixation and target = go
/count_target_nogotarget:   counts all trials in which cue = fixation and target = nogo


/cue_gotarget_correct:   counts all correct responses in trials in which cue = fixation and target = go
/cue_nogotarget_correct:  counts all correct responses in trials in which cue = fixation and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_cue_gotarget = 0
/count_cue_nogotarget = 0

/cue_gotarget_correct = 0
/cue_nogotarget_correct = 0

/sumrt = 0
/sumrt_cue_gotarget = 0
</values>

/targetcondition:     0,1,5,6,8,9,12,14,17,20,21,26,27,28,29,33,34,36,37,38,39,40,41 = go target; 2,3,4,7,10,11,13,15,16,18,19,22,23,24,25,30,31,32,35,42,43,44,45,46,47 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt for trial in which cue = fixation target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = fixation and target = nogo

/error_cue :    error rate for trials in which cue = fixation

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.targettype
/meanRT_cue_gotarget = values.sumrt_cue_gotarget/values.cue_gotarget_correct


/p_inhibition_g = (values.count_cue_nogotarget - values.cue_nogotarget_correct)/values.count_cue_nogotarget

/error_cue = ((values.count_cue_gotarget - values.cue_gotarget_correct) + (values.count_cue_nogotarget - values.cue_nogotarget_correct))/(values.count_cue_gotarget + values.count_cue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Put the index finger of your preferred hand on the spacebar. On each trial, a face will appear on the screen.
^After a short time, the face will dissapear.
^^Press the spacebar as quickly as possible whenever the face appears to be experiencing a painful touch.
^^if the face appears to be experienicng a neutral touch, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There will be a short practice section to begin with.
^^Press the spacebar to begin.
</page>


<page end>
^^This concludes this portion of the experiemnet.
^^Please notify your experimenter that you have finished.

</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = fixation
/ targettype:     0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go


= go
/p_inhibition_g:   error rate for trials in which cue = cue and response = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt (in ms) for trial in which cue = fixation and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)

/ postinstructions = (end)
/ blocks = [1=testblock1; 2=testblock2]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

<block testblock1>
/ trials = [1-8=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>


<block testblock2>
/ trials = [1-96=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (10,10,10,10,10)
 2 x Cue (1=fixation)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)
 middleeastern cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 48.
 Task runs 96 trials, i.e., each factor combination is repeated 1 time.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10, 10)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=fixation)

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,

 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=white go, 2=white no-go, 3=middleeastern go, 4=middleeastern no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,
 
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,0,0,0,
 57,57,0,57,57,
 0,0,57,0,57,
 0,57,57,0,0,
 57,57,0,0,0,
 0,57,57,57,57,
 0,0,0,57,57,
 0,57,57,57,57,
 57,57,0,0,0,
 0,0,0)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [20=blankscreen,fixation; 700=blankscreen; 700=target]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_cue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_cue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.cue_gotarget_correct += 1; values.sumrt_cue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.cue_nogotarget_correct += 1}]


/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text cue>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/items = targets
/ select = values.targettype
/ size = (300mm,300mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 0 = "nepaMEfe2.jpg"
/ 1 = "anpaMEfe2.jpg"
/ 1 = "annoMEfe2.jpg"
/ 1 = "nenoMEfe2.jpg"
/ 1 = "annoMEfe1.jpg"
/ 1 = "anpaMEfe1.jpg"
/ 1 = "nepaMEfe1.jpg"
/ 1 = "nenoMEfe1.jpg"
/ 1 = "nepaMEfe3.jpg"
/ 1 = "anpaMEfe3.jpg"
/ 1 = "nenoMEfe3.jpg"
/ 1 = "annoMEfe3.jpg"
/ 1 = "nepawhma1.jpg"
/ 1 = "nenowhma1.jpg"
/ 1 = "anpawhma1.jpg"
/ 1 = "annowhma1.jpg"
/ 1 = "anpawhma2.jpg"
/ 1 = "nepawhma2.jpg"
/ 4 = "annowhma2.jpg"
/ 4 = "nenowhma2.jpg"
/ 4 = "anpawhma3.jpg"
/ 4 = "nepawhma3.jpg"
/ 4 = "annowhma3.jpg"
/ 4 = "nenowhma3.jpg"
/ 2 = "annowhfe1.jpg"
/ 2 = "nenowhfe1.jpg"
/ 2 = "nepawhfe1.jpg"
/ 2 = "anpawhfe1.jpg"
/ 2 = "anpawhfe2.jpg"
/ 2 = "nepawhfe2.jpg"
/ 3 = "annowhfe2.jpg"
/ 3 = "nenowhfe2.jpg"
/ 3 = "nenowhfe3.jpg"
/ 3 = "anpawhfe3.jpg"
/ 3 = "nepawhfe3.jpg"
/ 3 = "annowhfe3.jpg"
/ 3 = "anpaMEma1.jpg"
/ 3 = "anpaMEma2.jpg"
/ 3 = "anpaMEma3.jpg"
/ 2 = "nepaMEma1.jpg"
/ 2 = "nepaMEma2.jpg"
/ 2 = "nepaMEma3.jpg"
/ 2 = "annoMEma1.jpg"
/ 2 = "annoMEma2.jpg"
/ 2 = "annoMEma3.jpg"
/ 2 = "nenoMEma1.jpg"
/ 2 = "nenoMEma2.jpg"
/ 2 = "nenoMEma3.jpg"
</item>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************


My issue is, the mean response time isnt showing any values in the data output. now i have chopped and changed a lot of things in the hope that i could substitute things but im having some trouble.
I have no previous knowldeg of coding so any help with this would be greatly appreciated.



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Inneedofcodinghelp - Monday, August 7, 2017
Hi Team,
I have been attempting to reverse engineer the below syntax from the test library:

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************



This is my current syntax











**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=white,2=middleeastern)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 middleeastern cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 10
/ iti = 10
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = fixation
/ targettype:    0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    count
s all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_target_gotarget:   counts all trials in which cue = fixation and target = go
/count_target_nogotarget:   counts all trials in which cue = fixation and target = nogo


/cue_gotarget_correct:   counts all correct responses in trials in which cue = fixation and target = go
/cue_nogotarget_correct:  counts all correct responses in trials in which cue = fixation and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_cue_gotarget = 0
/count_cue_nogotarget = 0

/cue_gotarget_correct = 0
/cue_nogotarget_correct = 0

/sumrt = 0
/sumrt_cue_gotarget = 0
</values>

/targetcondition:     0,1,5,6,8,9,12,14,17,20,21,26,27,28,29,33,34,36,37,38,39,40,41 = go target; 2,3,4,7,10,11,13,15,16,18,19,22,23,24,25,30,31,32,35,42,43,44,45,46,47 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt for trial in which cue = fixation target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = fixation and target = nogo

/error_cue :    error rate for trials in which cue = fixation

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.targettype
/meanRT_cue_gotarget = values.sumrt_cue_gotarget/values.cue_gotarget_correct


/p_inhibition_g = (values.count_cue_nogotarget - values.cue_nogotarget_correct)/values.count_cue_nogotarget

/error_cue = ((values.count_cue_gotarget - values.cue_gotarget_correct) + (values.count_cue_nogotarget - values.cue_nogotarget_correct))/(values.count_cue_gotarget + values.count_cue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Put the index finger of your preferred hand on the spacebar. On each trial, a face will appear on the screen.
^After a short time, the face will dissapear.
^^Press the spacebar as quickly as possible whenever the face appears to be experiencing a painful touch.
^^if the face appears to be experienicng a neutral touch, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There will be a short practice section to begin with.
^^Press the spacebar to begin.
</page>


<page end>
^^This concludes this portion of the experiemnet.
^^Please notify your experimenter that you have finished.

</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = fixation
/ targettype:     0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go


= go
/p_inhibition_g:   error rate for trials in which cue = cue and response = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt (in ms) for trial in which cue = fixation and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)

/ postinstructions = (end)
/ blocks = [1=testblock1; 2=testblock2]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

<block testblock1>
/ trials = [1-8=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>


<block testblock2>
/ trials = [1-96=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (10,10,10,10,10)
 2 x Cue (1=fixation)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)
 middleeastern cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 48.
 Task runs 96 trials, i.e., each factor combination is repeated 1 time.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10, 10)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=fixation)

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,

 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=white go, 2=white no-go, 3=middleeastern go, 4=middleeastern no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,
 
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,0,0,0,
 57,57,0,57,57,
 0,0,57,0,57,
 0,57,57,0,0,
 57,57,0,0,0,
 0,57,57,57,57,
 0,0,0,57,57,
 0,57,57,57,57,
 57,57,0,0,0,
 0,0,0)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [20=blankscreen,fixation; 700=blankscreen; 700=target]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_cue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_cue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.cue_gotarget_correct += 1; values.sumrt_cue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.cue_nogotarget_correct += 1}]


/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text cue>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/items = targets
/ select = values.targettype
/ size = (300mm,300mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 0 = "nepaMEfe2.jpg"
/ 1 = "anpaMEfe2.jpg"
/ 1 = "annoMEfe2.jpg"
/ 1 = "nenoMEfe2.jpg"
/ 1 = "annoMEfe1.jpg"
/ 1 = "anpaMEfe1.jpg"
/ 1 = "nepaMEfe1.jpg"
/ 1 = "nenoMEfe1.jpg"
/ 1 = "nepaMEfe3.jpg"
/ 1 = "anpaMEfe3.jpg"
/ 1 = "nenoMEfe3.jpg"
/ 1 = "annoMEfe3.jpg"
/ 1 = "nepawhma1.jpg"
/ 1 = "nenowhma1.jpg"
/ 1 = "anpawhma1.jpg"
/ 1 = "annowhma1.jpg"
/ 1 = "anpawhma2.jpg"
/ 1 = "nepawhma2.jpg"
/ 4 = "annowhma2.jpg"
/ 4 = "nenowhma2.jpg"
/ 4 = "anpawhma3.jpg"
/ 4 = "nepawhma3.jpg"
/ 4 = "annowhma3.jpg"
/ 4 = "nenowhma3.jpg"
/ 2 = "annowhfe1.jpg"
/ 2 = "nenowhfe1.jpg"
/ 2 = "nepawhfe1.jpg"
/ 2 = "anpawhfe1.jpg"
/ 2 = "anpawhfe2.jpg"
/ 2 = "nepawhfe2.jpg"
/ 3 = "annowhfe2.jpg"
/ 3 = "nenowhfe2.jpg"
/ 3 = "nenowhfe3.jpg"
/ 3 = "anpawhfe3.jpg"
/ 3 = "nepawhfe3.jpg"
/ 3 = "annowhfe3.jpg"
/ 3 = "anpaMEma1.jpg"
/ 3 = "anpaMEma2.jpg"
/ 3 = "anpaMEma3.jpg"
/ 2 = "nepaMEma1.jpg"
/ 2 = "nepaMEma2.jpg"
/ 2 = "nepaMEma3.jpg"
/ 2 = "annoMEma1.jpg"
/ 2 = "annoMEma2.jpg"
/ 2 = "annoMEma3.jpg"
/ 2 = "nenoMEma1.jpg"
/ 2 = "nenoMEma2.jpg"
/ 2 = "nenoMEma3.jpg"
</item>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************


My issue is, the mean response time isnt showing any values in the data output. now i have chopped and changed a lot of things in the hope that i could substitute things but im having some trouble.
I have no previous knowldeg of coding so any help with this would be greatly appreciated.


#1: Please don't paste entire scripts into a post. You can attach files by clicking +Insert -> Add File.
#2: You say you've been trying to reverse-engineer the go-nogo code. If you tell me what part(s) of the code you have trouble following through, I can assist with that.
#3: Regarding your modified / current syntax, please highlight and comment the actual changes you made and why (i.e. what is a given change _intended_ to achieve).

Thanks.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - Monday, August 7, 2017
Inneedofcodinghelp - Monday, August 7, 2017
Hi Team,
I have been attempting to reverse engineer the below syntax from the test library:

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************



This is my current syntax











**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=white,2=middleeastern)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 middleeastern cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 10
/ iti = 10
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = fixation
/ targettype:    0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    count
s all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_target_gotarget:   counts all trials in which cue = fixation and target = go
/count_target_nogotarget:   counts all trials in which cue = fixation and target = nogo


/cue_gotarget_correct:   counts all correct responses in trials in which cue = fixation and target = go
/cue_nogotarget_correct:  counts all correct responses in trials in which cue = fixation and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_cue_gotarget = 0
/count_cue_nogotarget = 0

/cue_gotarget_correct = 0
/cue_nogotarget_correct = 0

/sumrt = 0
/sumrt_cue_gotarget = 0
</values>

/targetcondition:     0,1,5,6,8,9,12,14,17,20,21,26,27,28,29,33,34,36,37,38,39,40,41 = go target; 2,3,4,7,10,11,13,15,16,18,19,22,23,24,25,30,31,32,35,42,43,44,45,46,47 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt for trial in which cue = fixation target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = fixation and target = nogo

/error_cue :    error rate for trials in which cue = fixation

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.targettype
/meanRT_cue_gotarget = values.sumrt_cue_gotarget/values.cue_gotarget_correct


/p_inhibition_g = (values.count_cue_nogotarget - values.cue_nogotarget_correct)/values.count_cue_nogotarget

/error_cue = ((values.count_cue_gotarget - values.cue_gotarget_correct) + (values.count_cue_nogotarget - values.cue_nogotarget_correct))/(values.count_cue_gotarget + values.count_cue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Put the index finger of your preferred hand on the spacebar. On each trial, a face will appear on the screen.
^After a short time, the face will dissapear.
^^Press the spacebar as quickly as possible whenever the face appears to be experiencing a painful touch.
^^if the face appears to be experienicng a neutral touch, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There will be a short practice section to begin with.
^^Press the spacebar to begin.
</page>


<page end>
^^This concludes this portion of the experiemnet.
^^Please notify your experimenter that you have finished.

</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = fixation
/ targettype:     0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go


= go
/p_inhibition_g:   error rate for trials in which cue = cue and response = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt (in ms) for trial in which cue = fixation and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)

/ postinstructions = (end)
/ blocks = [1=testblock1; 2=testblock2]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

<block testblock1>
/ trials = [1-8=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>


<block testblock2>
/ trials = [1-96=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (10,10,10,10,10)
 2 x Cue (1=fixation)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)
 middleeastern cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 48.
 Task runs 96 trials, i.e., each factor combination is repeated 1 time.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10, 10)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=fixation)

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,

 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=white go, 2=white no-go, 3=middleeastern go, 4=middleeastern no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,
 
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,0,0,0,
 57,57,0,57,57,
 0,0,57,0,57,
 0,57,57,0,0,
 57,57,0,0,0,
 0,57,57,57,57,
 0,0,0,57,57,
 0,57,57,57,57,
 57,57,0,0,0,
 0,0,0)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [20=blankscreen,fixation; 700=blankscreen; 700=target]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_cue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_cue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.cue_gotarget_correct += 1; values.sumrt_cue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.cue_nogotarget_correct += 1}]


/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text cue>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/items = targets
/ select = values.targettype
/ size = (300mm,300mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 0 = "nepaMEfe2.jpg"
/ 1 = "anpaMEfe2.jpg"
/ 1 = "annoMEfe2.jpg"
/ 1 = "nenoMEfe2.jpg"
/ 1 = "annoMEfe1.jpg"
/ 1 = "anpaMEfe1.jpg"
/ 1 = "nepaMEfe1.jpg"
/ 1 = "nenoMEfe1.jpg"
/ 1 = "nepaMEfe3.jpg"
/ 1 = "anpaMEfe3.jpg"
/ 1 = "nenoMEfe3.jpg"
/ 1 = "annoMEfe3.jpg"
/ 1 = "nepawhma1.jpg"
/ 1 = "nenowhma1.jpg"
/ 1 = "anpawhma1.jpg"
/ 1 = "annowhma1.jpg"
/ 1 = "anpawhma2.jpg"
/ 1 = "nepawhma2.jpg"
/ 4 = "annowhma2.jpg"
/ 4 = "nenowhma2.jpg"
/ 4 = "anpawhma3.jpg"
/ 4 = "nepawhma3.jpg"
/ 4 = "annowhma3.jpg"
/ 4 = "nenowhma3.jpg"
/ 2 = "annowhfe1.jpg"
/ 2 = "nenowhfe1.jpg"
/ 2 = "nepawhfe1.jpg"
/ 2 = "anpawhfe1.jpg"
/ 2 = "anpawhfe2.jpg"
/ 2 = "nepawhfe2.jpg"
/ 3 = "annowhfe2.jpg"
/ 3 = "nenowhfe2.jpg"
/ 3 = "nenowhfe3.jpg"
/ 3 = "anpawhfe3.jpg"
/ 3 = "nepawhfe3.jpg"
/ 3 = "annowhfe3.jpg"
/ 3 = "anpaMEma1.jpg"
/ 3 = "anpaMEma2.jpg"
/ 3 = "anpaMEma3.jpg"
/ 2 = "nepaMEma1.jpg"
/ 2 = "nepaMEma2.jpg"
/ 2 = "nepaMEma3.jpg"
/ 2 = "annoMEma1.jpg"
/ 2 = "annoMEma2.jpg"
/ 2 = "annoMEma3.jpg"
/ 2 = "nenoMEma1.jpg"
/ 2 = "nenoMEma2.jpg"
/ 2 = "nenoMEma3.jpg"
</item>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************


My issue is, the mean response time isnt showing any values in the data output. now i have chopped and changed a lot of things in the hope that i could substitute things but im having some trouble.
I have no previous knowldeg of coding so any help with this would be greatly appreciated.


#1: Please don't paste entire scripts into a post. You can attach files by clicking +Insert -> Add File.
#2: You say you've been trying to reverse-engineer the go-nogo code. If you tell me what part(s) of the code you have trouble following through, I can assist with that.
#3: Regarding your modified / current syntax, please highlight and comment the actual changes you made and why (i.e. what is a given change _intended_ to achieve).

Thanks.

<expressions>
...
/meanRT = values.sumrt/values.targettype
...
</expressions>

This definitely doesn't make sense. values.targettype reflects _what kind of target stimulus_ was displayed in a given trial. It does not provide some _count of trials_ which is what you would want to calculate a mean.

values.sumrt is a global variable. It reflects the sum of response latencies updated on a trial-by-trial basis.
To get a meaningful mean from that, you would divide that sum by the _number of trials_ run up to that point, which is what the original script does.

<expressions>
...
/meanRT = values.sumrt/values.correct_Go
...
</expressions>

where values.correct_Go is a global variable (also updated on a trial-by-trial basis) that reflects a running count of the number of correct go responses / trials.


Inneedofcodinghelp
Inneedofcodinghelp
Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)Associate Member (103 reputation)
Group: Forum Members
Posts: 2, Visits: 6
Dave - Monday, August 7, 2017
Dave - Monday, August 7, 2017
Inneedofcodinghelp - Monday, August 7, 2017
Hi Team,
I have been attempting to reverse engineer the below syntax from the test library:

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************



This is my current syntax











**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=white,2=middleeastern)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 middleeastern cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 10
/ iti = 10
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = fixation
/ targettype:    0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    count
s all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_target_gotarget:   counts all trials in which cue = fixation and target = go
/count_target_nogotarget:   counts all trials in which cue = fixation and target = nogo


/cue_gotarget_correct:   counts all correct responses in trials in which cue = fixation and target = go
/cue_nogotarget_correct:  counts all correct responses in trials in which cue = fixation and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_cue_gotarget = 0
/count_cue_nogotarget = 0

/cue_gotarget_correct = 0
/cue_nogotarget_correct = 0

/sumrt = 0
/sumrt_cue_gotarget = 0
</values>

/targetcondition:     0,1,5,6,8,9,12,14,17,20,21,26,27,28,29,33,34,36,37,38,39,40,41 = go target; 2,3,4,7,10,11,13,15,16,18,19,22,23,24,25,30,31,32,35,42,43,44,45,46,47 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt for trial in which cue = fixation target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = fixation and target = nogo

/error_cue :    error rate for trials in which cue = fixation

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.targettype
/meanRT_cue_gotarget = values.sumrt_cue_gotarget/values.cue_gotarget_correct


/p_inhibition_g = (values.count_cue_nogotarget - values.cue_nogotarget_correct)/values.count_cue_nogotarget

/error_cue = ((values.count_cue_gotarget - values.cue_gotarget_correct) + (values.count_cue_nogotarget - values.cue_nogotarget_correct))/(values.count_cue_gotarget + values.count_cue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Put the index finger of your preferred hand on the spacebar. On each trial, a face will appear on the screen.
^After a short time, the face will dissapear.
^^Press the spacebar as quickly as possible whenever the face appears to be experiencing a painful touch.
^^if the face appears to be experienicng a neutral touch, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There will be a short practice section to begin with.
^^Press the spacebar to begin.
</page>


<page end>
^^This concludes this portion of the experiemnet.
^^Please notify your experimenter that you have finished.

</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = fixation
/ targettype:     0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go


= go
/p_inhibition_g:   error rate for trials in which cue = cue and response = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt (in ms) for trial in which cue = fixation and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)

/ postinstructions = (end)
/ blocks = [1=testblock1; 2=testblock2]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

<block testblock1>
/ trials = [1-8=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>


<block testblock2>
/ trials = [1-96=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (10,10,10,10,10)
 2 x Cue (1=fixation)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)
 middleeastern cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 48.
 Task runs 96 trials, i.e., each factor combination is repeated 1 time.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10, 10)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=fixation)

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,

 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=white go, 2=white no-go, 3=middleeastern go, 4=middleeastern no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,
 
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,0,0,0,
 57,57,0,57,57,
 0,0,57,0,57,
 0,57,57,0,0,
 57,57,0,0,0,
 0,57,57,57,57,
 0,0,0,57,57,
 0,57,57,57,57,
 57,57,0,0,0,
 0,0,0)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [20=blankscreen,fixation; 700=blankscreen; 700=target]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_cue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_cue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.cue_gotarget_correct += 1; values.sumrt_cue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.cue_nogotarget_correct += 1}]


/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text cue>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/items = targets
/ select = values.targettype
/ size = (300mm,300mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 0 = "nepaMEfe2.jpg"
/ 1 = "anpaMEfe2.jpg"
/ 1 = "annoMEfe2.jpg"
/ 1 = "nenoMEfe2.jpg"
/ 1 = "annoMEfe1.jpg"
/ 1 = "anpaMEfe1.jpg"
/ 1 = "nepaMEfe1.jpg"
/ 1 = "nenoMEfe1.jpg"
/ 1 = "nepaMEfe3.jpg"
/ 1 = "anpaMEfe3.jpg"
/ 1 = "nenoMEfe3.jpg"
/ 1 = "annoMEfe3.jpg"
/ 1 = "nepawhma1.jpg"
/ 1 = "nenowhma1.jpg"
/ 1 = "anpawhma1.jpg"
/ 1 = "annowhma1.jpg"
/ 1 = "anpawhma2.jpg"
/ 1 = "nepawhma2.jpg"
/ 4 = "annowhma2.jpg"
/ 4 = "nenowhma2.jpg"
/ 4 = "anpawhma3.jpg"
/ 4 = "nepawhma3.jpg"
/ 4 = "annowhma3.jpg"
/ 4 = "nenowhma3.jpg"
/ 2 = "annowhfe1.jpg"
/ 2 = "nenowhfe1.jpg"
/ 2 = "nepawhfe1.jpg"
/ 2 = "anpawhfe1.jpg"
/ 2 = "anpawhfe2.jpg"
/ 2 = "nepawhfe2.jpg"
/ 3 = "annowhfe2.jpg"
/ 3 = "nenowhfe2.jpg"
/ 3 = "nenowhfe3.jpg"
/ 3 = "anpawhfe3.jpg"
/ 3 = "nepawhfe3.jpg"
/ 3 = "annowhfe3.jpg"
/ 3 = "anpaMEma1.jpg"
/ 3 = "anpaMEma2.jpg"
/ 3 = "anpaMEma3.jpg"
/ 2 = "nepaMEma1.jpg"
/ 2 = "nepaMEma2.jpg"
/ 2 = "nepaMEma3.jpg"
/ 2 = "annoMEma1.jpg"
/ 2 = "annoMEma2.jpg"
/ 2 = "annoMEma3.jpg"
/ 2 = "nenoMEma1.jpg"
/ 2 = "nenoMEma2.jpg"
/ 2 = "nenoMEma3.jpg"
</item>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************


My issue is, the mean response time isnt showing any values in the data output. now i have chopped and changed a lot of things in the hope that i could substitute things but im having some trouble.
I have no previous knowldeg of coding so any help with this would be greatly appreciated.


#1: Please don't paste entire scripts into a post. You can attach files by clicking +Insert -> Add File.
#2: You say you've been trying to reverse-engineer the go-nogo code. If you tell me what part(s) of the code you have trouble following through, I can assist with that.
#3: Regarding your modified / current syntax, please highlight and comment the actual changes you made and why (i.e. what is a given change _intended_ to achieve).

Thanks.

<expressions>
...
/meanRT = values.sumrt/values.targettype
...
</expressions>

This definitely doesn't make sense. values.targettype reflects _what kind of target stimulus_ was displayed in a given trial. It does not provide some _count of trials_ which is what you would want to calculate a mean.

values.sumrt is a global variable. It reflects the sum of response latencies updated on a trial-by-trial basis.
To get a meaningful mean from that, you would divide that sum by the _number of trials_ run up to that point, which is what the original script does.

<expressions>
...
/meanRT = values.sumrt/values.correct_Go
...
</expressions>

where values.correct_Go is a global variable (also updated on a trial-by-trial basis) that reflects a running count of the number of correct go responses / trials.


Hi there, thanks so much for your response.
I believe I put targettype in /meanRT =values.sumrt/ section because values.correct go wasn't showing data in the raw data file. I have changed it back and still isn't working.
Im working if its because I changed the cue to a fixation and made it run so that both cues would simply be an '+' fixation between images.
Do you have any other suggestions as to why there would be no numbers coming up in the output under 'expressions.meanrt'?
Thanks

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Inneedofcodinghelp - Monday, August 7, 2017
Dave - Monday, August 7, 2017
Dave - Monday, August 7, 2017
Inneedofcodinghelp - Monday, August 7, 2017
Hi Team,
I have been attempting to reverse engineer the below syntax from the test library:

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 1000
/ iti = 700
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = vertical cue; 2 = horizontal cue
/ targettype:    1 = vertical go
       2 = vertical nogo
       3 = horizonal go
       4 = horizonal nogo
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    counts all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_verticalcue_gotarget:   counts all trials in which cue = vertical and target = go
/count_verticalcue_nogotarget:   counts all trials in which cue = vertical and target = nogo
/count_horizontalcue_gotarget:   counts all trials in which cue = horizontal and target = go
/count_horizontalcue_nogotarget:  counts all trials in which cue = horizontal and target = nogo

/verticalcue_gotarget_correct:   counts all correct responses in trials in which cue = vertical and target = go
/verticalcue_nogotarget_correct:  counts all correct responses in trials in which cue = vertical and target = nogo
/horizontalcue_gotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = go
/horizontalcue_nogotarget_correct:  counts all correct responses in trials in which cue = horizontal and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_verticalcue_gotarget:   sums latency for correct trials in which cue = vertical and target = go
/sumrt_horizontalcue_gotarget:   sums latency for correct trials in which cue = horizontal and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_verticalcue_gotarget = 0
/count_verticalcue_nogotarget = 0
/count_horizontalcue_gotarget = 0
/count_horizontalcue_nogotarget = 0

/verticalcue_gotarget_correct = 0
/verticalcue_nogotarget_correct = 0
/horizontalcue_gotarget_correct = 0
/horizontalcue_nogotarget_correct = 0

/sumrt = 0
/sumrt_verticalcue_gotarget = 0
/sumrt_horizontalcue_gotarget = 0
</values>

/targetcondition:     1 = go target; 2 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt for trial in which cue = horizontal and target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = vertical and target = nogo
/p_omission_n:      error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:     error rate for trials in which cue = horizontal and target = nogo

/error_verticalcue :    error rate for trials in which cue = vertical
/error_horizontalcue :    error rate for trials in which cue = horizontal

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.correct_Go
/meanRT_verticalcue_gotarget = values.sumrt_verticalcue_gotarget/values.verticalcue_gotarget_correct
/meanRT_horizontalcue_gotarget = values.sumrt_horizontalcue_gotarget/values.horizontalcue_gotarget_correct


/p_inhibition_g = (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct)/values.count_verticalcue_nogotarget
/p_omission_n = (values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct)/values.count_horizontalcue_gotarget
/p_inhibition_n = (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct)/values.count_horizontalcue_nogotarget

/error_verticalcue = ((values.count_verticalcue_gotarget - values.verticalcue_gotarget_correct) + (values.count_verticalcue_nogotarget - values.verticalcue_nogotarget_correct))/(values.count_verticalcue_gotarget + values.count_verticalcue_nogotarget)
/error_horizontalcue = ((values.count_horizontalcue_gotarget - values.horizontalcue_gotarget_correct) + (values.count_horizontalcue_nogotarget - values.horizontalcue_nogotarget_correct))/(values.count_horizontalcue_gotarget + values.count_horizontalcue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Welcome to the Go / No-Go Task!
^^Put the index finger of your preferred hand on the spacebar. On each trial, a white rectangle will appear on the screen.
^After a short time, the rectangle will either turn green or blue.
^^Press the spacebar as quickly as possible whenever the rectangle turns green.
^^If the rectangle turns blue, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There'll be no practice. The task will take about 10 minutes to complete.
^^Press the spacebar to begin.
</page>

<page end>
^^This concludes the Go / No-Go Task.
^^Thanks for participating!
</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = vertical cue; 2 = horizontal cue
/ targettype:     1 = vertical go
        2 = vertical nogo
        3 = horizonal go
        4 = horizonal nogo
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 picture.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go

/error_verticalcue :   error rate for trials in which cue = vertical
/error_horizontalcue :   error rate for trials in which cue = horizontal


/p_inhibition_g:   error rate for trials in which cue = vertical and target = nogo
/p_omission_n:    error rate for trials in which cue = horizontal and target = go
/p_inhibition_n:   error rate for trials in which cue = horizontal and target = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_verticalcue_gotarget:  mean rt (in ms) for trial in which cue = vertical and target = go (correct responses only)
/meanRT_horizontalcue_gotarget:  mean rt (in ms) for trial in which cue = horizontal and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_verticalcue, expressions.error_horizontalcue,
expressions.p_omission_g, expressions.p_inhibition_g, expressions.p_omission_n, expressions.p_inhibition_n,
expressions.meanrt, expressions.meanrt_verticalcue_gotarget, expressions.meanrt_horizontalcue_gotarget]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)
/ postinstructions = (end)
/ blocks = [1=testblock]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<block testblock>
/ trials = [1-250=sequence(cue,target,iti)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=vertical,2=horizontal)
 2 x Target (Go, No-Go)
 
 Vertical cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 Horizontal cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,

 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500,
 100,100,100,100,100,
 200,200,200,200,200,
 300,300,300,300,300,
 400,400,400,400,400,
 500,500,500,500,500)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=vertical (go) cue, 2=horizontal (nogo) cue)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,

 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2,
 2,2,2,2,2)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=vertical go, 2=vertical no-go, 3=horizontal go, 4=horizontal no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,
 1,1,1,1,2,

 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3,
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,
 57,57,57,57,0,

 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57,
 0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [0=blankscreen,fixation; 800=blankscreen; 1300=cue]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_verticalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_verticalcue_nogotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0) {values.count_horizontalcue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0) {values.count_horizontalcue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.verticalcue_gotarget_correct += 1; values.sumrt_verticalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.verticalcue_nogotarget_correct += 1}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp != 0 && trial.target.correct) {values.horizontalcue_gotarget_correct += 1; values.sumrt_horizontalcue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 2 && values.correctresp == 0 && trial.target.correct) {values.horizontalcue_nogotarget_correct += 1}]

/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture cue>
/ items = cues
/ select = values.cuetype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item cues>
/ 1 = "VCUE.jpg"
/ 2 = "HCUE.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/ items = targets
/ select = values.targettype
/ size = (75mm,75mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 1 = "VGO.jpg"
/ 2 = "VNOGO.jpg"
/ 3 = "HGO.jpg"
/ 4 = "HNOGO.jpg"
</item>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************



This is my current syntax











**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cued Go / No-Go Task (Fillmore et al., 2006)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

 This script implements the Cued Go / No-Go Task described in

 Fillmore, M. T., Rush, C. R., & Hays, L. (2006). Acute effects of cocaine in two models of inhibitory control:
 implications of non-linear dose effects. Addiction, 101, 1323–1332.

 Note: Factorial design with
 5 x SOA (100,200,300,400,500)
 2 x Cue (1=white,2=middleeastern)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 4:1 (80% go trials, 20% no-go trials)
 middleeastern cue go / no-go ratio is 1:4 (20% go trials, 80% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 50.
 Task runs 250 trials, i.e., each factor combination is repeated 5 times.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Script Version:  1.0 (Final)
 Last Modified:  09-09-2015 by K. Borchert (katjab@millisecond.com) for Millisecond Software LLC

 Copyright ©  09-09-2015 Millisecond Software
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Values
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Configurable values for
 - responsetimeout and
 - ITI (Inter-Trial-Interval)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<values userparams>
/ responsetimeout = 10
/ iti = 10
</values>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 The below values should not be changed.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
/completed:     0 = script was not completed; 1 = script was completed (all conditions were run)
/ soa:      stimulus onset asynchrony
/ cuetype:     1 = fixation
/ targettype:    0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/ correctresp:    stores the correct trial response (57 -> spacebar; ""-> do nothing)
/ trialcount:    count
s all trials
/correctcount:    counts the overall number of correct responses
/count_go:     counts all target go trials
/correct_go:    counts the number of correct go responses
/count_nogo:    counts all target nogo trials
/correct_nogo:    counts the number of correct nogo responses

/count_target_gotarget:   counts all trials in which cue = fixation and target = go
/count_target_nogotarget:   counts all trials in which cue = fixation and target = nogo


/cue_gotarget_correct:   counts all correct responses in trials in which cue = fixation and target = go
/cue_nogotarget_correct:  counts all correct responses in trials in which cue = fixation and target = nogo

/sumrt:         sums latency for correct target = go trials
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go
/sumrt_cue_gotarget:   sums latency for correct trials in which cue = fixation and target = go

<values taskparams>
/completed = 0
/ soa = 0
/ cuetype = 0
/ targettype = 0
/ correctresp = 0
/ trialcount = 0
/correctcount = 0
/count_go = 0
/correct_go = 0
/count_nogo = 0
/correct_nogo = 0

/count_cue_gotarget = 0
/count_cue_nogotarget = 0

/cue_gotarget_correct = 0
/cue_nogotarget_correct = 0

/sumrt = 0
/sumrt_cue_gotarget = 0
</values>

/targetcondition:     0,1,5,6,8,9,12,14,17,20,21,26,27,28,29,33,34,36,37,38,39,40,41 = go target; 2,3,4,7,10,11,13,15,16,18,19,22,23,24,25,30,31,32,35,42,43,44,45,46,47 = nogo target

/errorrate:       overall error rate
/errorrate_gotarget:    error rate for target = go
/errorrate_Nogotarget:    error rate for target = no go

/meanRT:       overall mean rt for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt for trial in which cue = fixation target = go (correct responses only)


/p_inhibition_g:     error rate for trials in which cue = fixation and target = nogo

/error_cue :    error rate for trials in which cue = fixation

<expressions>
/targetcondition = if (values.targettype == 1 || values.targettype == 3) 1 else 2
/errorrate = (values.trialcount - values.correctcount)/values.trialcount
/errorrate_gotarget = (values.count_Go - values.correct_Go)/values.count_Go
/errorrate_nogotarget = (values.count_NoGo - values.correct_NoGo)/values.count_NoGo

/meanRT = values.sumrt/values.targettype
/meanRT_cue_gotarget = values.sumrt_cue_gotarget/values.cue_gotarget_correct


/p_inhibition_g = (values.count_cue_nogotarget - values.cue_nogotarget_correct)/values.count_cue_nogotarget

/error_cue = ((values.count_cue_gotarget - values.cue_gotarget_correct) + (values.count_cue_nogotarget - values.cue_nogotarget_correct))/(values.count_cue_gotarget + values.count_cue_nogotarget)
</expressions>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Task Instructions
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<instruct>
/ windowsize = (100%,80%)
/ inputdevice = keyboard
/ prevkey = (25)
/ nextkey = (57)
/ prevlabel = "Press P to go back"
/ nextlabel = "Press the spacebar"
/ finishlabel = "Press the spacebar"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
</instruct>

<page intro>
^^Put the index finger of your preferred hand on the spacebar. On each trial, a face will appear on the screen.
^After a short time, the face will dissapear.
^^Press the spacebar as quickly as possible whenever the face appears to be experiencing a painful touch.
^^if the face appears to be experienicng a neutral touch, do not respond at all.
^Try to respond as quickly as possible while making as few errors as possible.
^^There will be a short practice section to begin with.
^^Press the spacebar to begin.
</page>


<page end>
^^This concludes this portion of the experiemnet.
^^Please notify your experimenter that you have finished.

</page>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Custom Data Output
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

**********************
raw data file
**********************
date/time/subject:    date and time of experimental session with the current subjectnumber
blocknum/blockcode:    number of the current block and name of current block
/ trialcount:     current trialcount
trialcode:      name of current trial
response:      response made (either 57 = Spacebar or "" for no response)
latency:      the latency of the response in ms (or if no response: trialduration)
correct:      the accuracy of response (1 = correct; 0 = error)
error:       1 = error; 0 = no error
picture.cue.currentitem:  the image file presented as the cue
picture.target.currentitem:  the image file presented as the target 
/ cuetype:      1 = fixation
/ targettype:     0 = nepaMEfe2
        1 = anpaMEfe2
        2 = annoMEfe2
        3 = nenoMEfe2
        4 = annoMEfe1
        5 = anpaMEfe1
        6 = nepaMEfe1
        7 = nenoMEfe1
        8 = nepaMEfe3
        9 = anpaMEfe3
        10 = nenoMEfe3
        11 = annoMEfe3
        12 = nepawhma1
        13 = nenowhma1
        14 = anpawhma1
        15 = annowhma1
        16 = anpawhma2
        17 = nepawhma2
        18 = annowhma2
        19 = nenowhma2
        20 = anpawhma3
        21 = nepawhma3
        22 = annowhma3
        23 = nenowhma3
        24 = annowhfe1
        25 = nenowhfe1
        26 = nepawhfe1
        27 = anpawhfe1
        28 = anpawhfe2
        29 = nepawhfe2
        30 = annowhfe2
        31 = nenowhfe2
        32 = nenowhfe3
        33 = anpawhfe3
        34 = nepawhfe3
        35 = annowhfe3
        36 = anpaMEma1
        37 = anpaMEma2
        38 = anpaMEma3
        39 = nepaMEma1
        40 = nepaMEma2
        41 = nepaMEma3
        42 = annoMEma1
        43 = annoMEma2
        44 = annoMEma3
        45 = nenoMEma1
        46 = nenoMEma2
        47 = nenoMEma3
/targetcondition:    1 = go target; 2 = nogo target
/ soa:       current stimulus onset asynchrony

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

**********************
summary data file
**********************
script.startdate:   date script was run
script.starttime:   time script was started
script.subjectid:   subject id number
script.groupid:    group id number
script.elapsedtime:   time it took to run script (in ms)
/completed:     0 = script was not completed; 1 = script was completed (all conditions run)

/errorrate:     overall error rate

/errorrate_gotarget:  error rate for target = go
/errorrate_Nogotarget:  error rate for target = no go


= go
/p_inhibition_g:   error rate for trials in which cue = cue and response = nogo

/meanRT:       overall mean rt (in ms) for target = go (correct responses only)
/meanRT_cue_gotarget:  mean rt (in ms) for trial in which cue = fixation and target = go (correct responses only)


<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Experiment Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<expt>
/ preinstructions = (intro)

/ postinstructions = (end)
/ blocks = [1=testblock1; 2=testblock2]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Block Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************

<block testblock1>
/ trials = [1-8=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>


<block testblock2>
/ trials = [1-96=noreplace(cue, target, cue, target,cue , target, cue, target, cue, target, cue, target, cue)]
</block>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Lists
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Note: Factorial design with
 5 x SOA (10,10,10,10,10)
 2 x Cue (1=fixation)
 2 x Target (Go, No-Go)
 
 white cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)
 middleeastern cue go / no-go ratio is 1:1 (50% go trials, 50% no-go trials)

 Minimum number of trials required to fulfill the above conditions is 48.
 Task runs 96 trials, i.e., each factor combination is repeated 1 time.
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 SOAs in ms
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list soa>
/ items = (
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10,10,10,10,10,
 10, 10)
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cues (1=fixation)

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list cuetype>
/ items = (
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,

 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1,1,1,1,1,
 1)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Targets (1=white go, 2=white no-go, 3=middleeastern go, 4=middleeastern no-go)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list targettype>
/ items = (
 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,

 1,2,3,4,
 5,6,7,8,
 8,9,10,11,
 12,13,14,15,
 16,17,18,19,
 20,21,22,23,
 24,25,26,27,
 28,29,30,31,
 32,33,34,35,
 36,37,38,39,
 40,41,42,43,
 44,45,46,47,
 48,
 
 4,4,4,4,3)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
 57,57,0,0,0,
 57,57,0,57,57,
 0,0,57,0,57,
 0,57,57,0,0,
 57,57,0,0,0,
 0,57,57,57,57,
 0,0,0,57,57,
 0,57,57,57,57,
 57,57,0,0,0,
 0,0,0)
/ selectionmode = list.soa.currentindex
</list>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Trial Elements
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<trial cue>
/ ontrialbegin = [values.soa=list.soa.nextvalue; values.cuetype=list.cuetype.nextvalue;
 values.targettype=list.targettype.nextvalue; values.correctresp=list.correctresp.nextvalue;
 values.trialcount+=1]
/ stimulustimes = [20=blankscreen,fixation; 700=blankscreen; 700=target]
/ validresponse = (noresponse)
/ trialduration = 1300 + values.soa
/ recorddata = false
</trial>

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ validresponse = (57, noresponse)
/ iscorrectresponse = [trial.target.response==values.correctresp]
/ timeout = values.responsetimeout
/ ontrialend = [if (trial.target.correct) values.correctcount += 1]
/ ontrialend = [if (values.correctresp != 0 && trial.target.correct) {values.correct_go += 1;values.sumrt += trial.target.latency} ]
/ ontrialend = [if (values.correctresp == 0 && trial.target.correct) values.correct_nogo += 1]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0) {values.count_cue_gotarget += 1}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0) {values.count_cue_nogotarget += 1}]

/ontrialend = [if (values.cuetype == 1 && values.correctresp != 0 && trial.target.correct) {values.cue_gotarget_correct += 1; values.sumrt_cue_gotarget += trial.target.latency}]
/ontrialend = [if (values.cuetype == 1 && values.correctresp == 0 && trial.target.correct) {values.cue_nogotarget_correct += 1}]


/ recorddata = true
</trial>

<trial iti>
/ stimulustimes = [0=blankscreen]
/ validresponse = (noresponse)
/ trialduration = values.iti
/ recorddata = false
</trial>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Cue Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text cue>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Target Stims
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<picture target>
/items = targets
/ select = values.targettype
/ size = (300mm,300mm)
/ position = (50%,50%)
/ erase = false
</picture>

<item targets>
/ 0 = "nepaMEfe2.jpg"
/ 1 = "anpaMEfe2.jpg"
/ 1 = "annoMEfe2.jpg"
/ 1 = "nenoMEfe2.jpg"
/ 1 = "annoMEfe1.jpg"
/ 1 = "anpaMEfe1.jpg"
/ 1 = "nepaMEfe1.jpg"
/ 1 = "nenoMEfe1.jpg"
/ 1 = "nepaMEfe3.jpg"
/ 1 = "anpaMEfe3.jpg"
/ 1 = "nenoMEfe3.jpg"
/ 1 = "annoMEfe3.jpg"
/ 1 = "nepawhma1.jpg"
/ 1 = "nenowhma1.jpg"
/ 1 = "anpawhma1.jpg"
/ 1 = "annowhma1.jpg"
/ 1 = "anpawhma2.jpg"
/ 1 = "nepawhma2.jpg"
/ 4 = "annowhma2.jpg"
/ 4 = "nenowhma2.jpg"
/ 4 = "anpawhma3.jpg"
/ 4 = "nepawhma3.jpg"
/ 4 = "annowhma3.jpg"
/ 4 = "nenowhma3.jpg"
/ 2 = "annowhfe1.jpg"
/ 2 = "nenowhfe1.jpg"
/ 2 = "nepawhfe1.jpg"
/ 2 = "anpawhfe1.jpg"
/ 2 = "anpawhfe2.jpg"
/ 2 = "nepawhfe2.jpg"
/ 3 = "annowhfe2.jpg"
/ 3 = "nenowhfe2.jpg"
/ 3 = "nenowhfe3.jpg"
/ 3 = "anpawhfe3.jpg"
/ 3 = "nepawhfe3.jpg"
/ 3 = "annowhfe3.jpg"
/ 3 = "anpaMEma1.jpg"
/ 3 = "anpaMEma2.jpg"
/ 3 = "anpaMEma3.jpg"
/ 2 = "nepaMEma1.jpg"
/ 2 = "nepaMEma2.jpg"
/ 2 = "nepaMEma3.jpg"
/ 2 = "annoMEma1.jpg"
/ 2 = "annoMEma2.jpg"
/ 2 = "annoMEma3.jpg"
/ 2 = "nenoMEma1.jpg"
/ 2 = "nenoMEma2.jpg"
/ 2 = "nenoMEma3.jpg"
</item>


**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Fixation
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text fixation>
/ items = ("+")
/ fontstyle = ("Arial", 10.00%, true)
/ erase = false
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Blank Screen
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<shape blankscreen>
/ shape = rectangle
/ color = (white)
/ erase = false
/ size = (100%, 100%)
/ position = (50%, 50%)
</shape>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Debug Stuff
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<text debug>
/ items = ("SOA=<%values.soa%> | Cue=<%values.cuetype%> | Target=<%values.targettype%>
Key=<%values.correctresp%> | Response=<%trial.target.response%> | RT=<%trial.target.latency%> | Correct=<%trial.target.correct%>")
/ txbgcolor = (white)
/ erase = false
/ size = (75%,5%)
/ position = (50%,5%)
</text>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 Default Settings
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (1,1)
/ minimumversion = "4.0.0.0"
/ fontstyle = ("Arial", 2.50%, true)
/ screencolor = (white)
</defaults>

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
 End Of File
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************


My issue is, the mean response time isnt showing any values in the data output. now i have chopped and changed a lot of things in the hope that i could substitute things but im having some trouble.
I have no previous knowldeg of coding so any help with this would be greatly appreciated.


#1: Please don't paste entire scripts into a post. You can attach files by clicking +Insert -> Add File.
#2: You say you've been trying to reverse-engineer the go-nogo code. If you tell me what part(s) of the code you have trouble following through, I can assist with that.
#3: Regarding your modified / current syntax, please highlight and comment the actual changes you made and why (i.e. what is a given change _intended_ to achieve).

Thanks.

<expressions>
...
/meanRT = values.sumrt/values.targettype
...
</expressions>

This definitely doesn't make sense. values.targettype reflects _what kind of target stimulus_ was displayed in a given trial. It does not provide some _count of trials_ which is what you would want to calculate a mean.

values.sumrt is a global variable. It reflects the sum of response latencies updated on a trial-by-trial basis.
To get a meaningful mean from that, you would divide that sum by the _number of trials_ run up to that point, which is what the original script does.

<expressions>
...
/meanRT = values.sumrt/values.correct_Go
...
</expressions>

where values.correct_Go is a global variable (also updated on a trial-by-trial basis) that reflects a running count of the number of correct go responses / trials.


Hi there, thanks so much for your response.
I believe I put targettype in /meanRT =values.sumrt/ section because values.correct go wasn't showing data in the raw data file. I have changed it back and still isn't working.
Im working if its because I changed the cue to a fixation and made it run so that both cues would simply be an '+' fixation between images.
Do you have any other suggestions as to why there would be no numbers coming up in the output under 'expressions.meanrt'?
Thanks

> I believe I put targettype in /meanRT =values.sumrt/ section because values.correct go wasn't showing data in the raw data file.

But you're not logging values.correct_go at all? It's not logged in your <data> element

<data>
/file = "CuedGoNoGo_rawdata.iqdat"
/ columns = [date,time,subject,blocknum,blockcode,values.trialcount,trialcode,response,latency,correct,error,
 text.cue.currentitem,picture.target.currentitem,values.cuetype,values.targettype, expressions.targetcondition, values.soa]
/ separatefiles = true
</data>

and not logged in your <summarydata> element:

<summarydata >
/file = "CuedGoNoGo_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed,
expressions.errorrate, expressions.errorrate_gotarget, expressions.errorrate_Nogotarget,
expressions.error_cue,
expressions.p_omission_g, expressions.p_inhibition_g]
</summarydata>

And, for what it's worth, you are not logging expressions.meanRT either.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search