Millisecond Forums

AAT (approach avoidance task) help - linking image and text stimuli

https://forums.millisecond.com/Topic15548.aspx

By acarnegie - 2/17/2015

Hello,

I've downloaded the AAT script and edited it to use my image stimuli rather than the preprogrammed ones. However, for one of my experimental conditions, I would like to have a message flash briefly (~5 milliseconds) on the screen before the appearance of certain images. Is there any way to do this? I have very limited knowledge of coding or how this would be done as this is my first attempt at creating my own experiment. I can post the script that I have so far if that would be helpful.

Thank you!
-Amanda
By Dave - 2/17/2015

You need to add a <text> element to your script that contains the message(s). You need to "link" its items to the corresponding image stimuli as detailed in the "How to present stimulus pairs" topic in the documentation (or some variation thereof). Finally, you need to have the proper <trial> element in the script display the text stimulus.

You cannot display the message for 5ms only. That would require your display to operate at a refresh rate of 200Hz -- it is *very* unlikely that your monitor is able to do that. Typical refresh rates are in the range of 50Hz to 100Hz, i.e., a single display frame (and hence the minimum display duration for a given stimulus) lasts between 20ms and 10ms.

In general, I would recommend working through the tutorials included in the documentation prior to moving on -- that should give you insight into the basics of Inquisit syntax. Prior to modifying the AAT, then, make sure to first work through the original (unmodified) script and pay particular attention to the comments. Those will give you an idea what the respective part of the code does and how to modify it.
By acarnegie - 2/22/2015

Below is a posting of the script that I am using. I would like to be able to connect the text phrase "trigger warning" to all item targets starting with the number 1 (for example, 1_A_L.jpg, and so on) to appear for a few milliseconds before presentation of the image itself. I'm relatively unclear as to what the last post means (again, very limited coding knowledge) and I looked at the stimuli linking forum you connected me to. It only connects to text stimuli though. Is there any way to do this?




<values>
/Startheight_ratioA = 0.5
/Startheight_ratioB = 0.6
/MinHeight_ratioA = 0.05
/MinHeight_ratioB = 0.1
/intertrialinterval = 300
/pixeltolerance = 5
</values>

<item targets>
/1 = "1_A_L.jpg"
/2 = "1_SP_L.jpg"
/3 = "1_P_L.jpg"
/4 = "1_BL_L.jpg"
/5 = "1_G_L.jpg"
/6 = "1_DR_L.jpg"
/7 = "1_AL_L.jpg"
/8 = "1_D_L.jpg"
/9 = "1_PB_L.jpg"
/10 = "1_WA_L.jpg"

/11 = "1_A_P.jpg"
/12 = "1_SP_P.jpg"
/13 = "1_P_P.jpg"
/14 = "1_BL_P.jpg"
/15 = "1_G_P.jpg"
/16 = "1_DR_P.jpg"
/17 = "1_AL_P.jpg"
/18 = "1_D_P.jpg"
/19 = "1_PB_P.jpg"
/20 = "1_WA_P.jpg"

/21 = "1_R_L.jpg"
/22 = "1_AB_L.jpg"
/23 = "1_V_L.jpg"
/24 = "1_W_L.jpg"
/25 = "1_B_L.jpg"
/26 = "1_S_L.jpg"
/27 = "1_NU_L.jpg"
/28 = "1_DD_L.jpg"
/29 = "1_AW_L.jpg"
/30 = "1_DS_L.jpg"

/31 = "1_R_P.jpg"
/32 = "1_AB_P.jpg"
/33 = "1_V_P.jpg"
/34 = "1_W_P.jpg"
/35 = "1_B_P.jpg"
/36 = "1_S_P.jpg"
/37 = "1_NU_P.jpg"
/38 = "1_DD_P.jpg"
/39 = "1_AW_P.jpg"
/40 = "1_DS_P.jpg"

/41 = "2_1_L.jpg"
/42 = "2_2_L.jpg"
/43 = "2_3_L.jpg"
/44 = "2_4_L.jpg"
/45 = "2_5_L.jpg"
/46 = "2_6_L.jpg"
/47 = "2_7_L.jpg"
/48 = "2_8_L.jpg"
/49 = "2_9_L.jpg"
/50 = "2_10_L.jpg"

/51 = "2_1_P.jpg"
/52 = "2_2_P.jpg"
/53 = "2_3_P.jpg"
/54 = "2_4_P.jpg"
/55 = "2_5_P.jpg"
/56 = "2_6_P.jpg"
/57 = "2_7_P.jpg"
/58 = "2_8_P.jpg"
/59 = "2_9_P.jpg"
/60 = "2_10_P.jpg"

/61 = "2_11_L.jpg"
/62 = "2_12_L.jpg"
/63 = "2_13_L.jpg"
/64 = "2_14_L.jpg"
/65 = "2_15_L.jpg"
/66 = "2_16_L.jpg"
/67 = "2_17_L.jpg"
/68 = "2_18_L.jpg"
/69 = "2_19_L.jpg"
/70 = "2_20_L.jpg"

/71 = "2_11_P.jpg"
/72 = "2_12_P.jpg"
/73 = "2_13_P.jpg"
/74 = "2_14_P.jpg"
/75 = "2_15_P.jpg"
/76 = "2_16_P.jpg"
/77 = "2_17_P.jpg"
/78 = "2_18_P.jpg"
/79 = "2_19_P.jpg"
/80 = "2_20_P.jpg"
</item>

<item practicestimuli>
/1 = "grayrectangle_L.jpg"
/2 = "grayrectangle_P.jpg"
</item>

<instruct >
/ windowsize = (90%, 90%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/inputdevice = mouse
/finishlabel = "Click here to continue"
/nextlabel = "Click here to continue"
/prevlabel = "Click here to go back"
</instruct>

<page intro>
In the following task, you will be presented images either in landscape or portrait format.
^^Your task is to: move the MOUSE
^^* UP to the top of the screen if you see an image in <%values.format2%> format
^              (the image will SHRINK)
^^* DOWN to the bottom of the screen if you see an image in <%values.format1%> format
^              (the image will ENLARGE)
^^^Afterwards you will be asked to click on an 'X' in the middle of the screen to bring the mouse cursor back into the center.
^^Once you clicked on it a new image will be presented.
^^^Click the button to start practice.
</page>

<page practice>
This is practice.
^^You will be presented with gray rectangles in either landscape or portrait format.
^^**********************************************************************************
^* Move the mouse UP if if you see a rectangle in <%values.format2%> format
^^* Move the mouse DOWN if you see a rectangle in <%values.format1%> format
^***********************************************************************************
^^Afterwards you will be asked to click on an 'X' in the middle of the screen to bring the mouse cursor back into the center.
^Once you clicked on it a new image will be presented.
^^Be as fast and accurate as you possibly can.
^^^^Click the button to start 20 practice trials.
</page>

<page taskinstructions>
This is the real task.
^^You will be presented with different types of images in either landscape or portrait format. Just like you did during practice,
^^**********************************************************************************
^* Move the mouse UP if you see a rectangle in <%values.format2%> format
^^* Move the mouse DOWN if you see a rectangle in <%values.format1%> format
^***********************************************************************************
^^^Be as fast and accurate as you possibly can. There will be 80 images total.
^^^Click the button to start.
</page>

<page End>
You have reached the end of the task.
^^THANK YOU FOR YOUR PARTICIPATION!!!
</page>

<item trialstartinstructions>
/1 = "Click on the center of the 'X'"
</item>

<list category1>
/ items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
/ replace = false
</list>

<list category2>
/ items = (11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
/ replace = false
</list>

<list category3>
/ items = (21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
/ replace = false
</list>

<list category4>
/ items = (31, 32, 33, 34, 35, 36, 37, 38, 39, 40)
/ replace = false
</list>

<list category5>
/ items = (41, 42, 43, 44, 45, 46, 47, 48, 49, 50)
/ replace = false
</list>

<list category6>
/ items = (51, 52, 53, 54, 55, 56, 57, 58, 59, 60)
/ replace = false
</list>

<list category7>
/ items = (61, 62, 63, 64, 65, 66, 67, 68, 69, 70)
/ replace = false
</list>

<list category8>
/ items = (71, 72, 73, 74, 75, 76, 77, 78, 79, 80)
/ replace = false
</list>

<data >
/file = "AATmouseinput_raw.iqdat"
/ separatefiles = true
/ columns = [date, time, subject, values.expcondition, blockcode, blocknum, trialcode, values.trialcode, values.stimulus, values.mouse_y,
values.initialresponse, values.correct, values.finalresponse, values.changedirection,
values.RT, values.completeRT]
</data>

<summarydata >
/file = "ATTmouseinput_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.elapsedtime, values.completed, values.expcondition,
expressions.aat_diffscore_cat1, expressions.aat_diffscore_cat2,
expressions.aat_diffscore_cat3, expressions.aat_diffscore_cat4, values.sequence]
</summarydata>

<defaults >
/canvasaspectratio = (4,3)
/minimumversion = "4.0.4.0"
/ inputdevice = mouse
</defaults>

<values >
/totaltrialcount = 80
/nextstimulus = 0
/selectstimulus = 0
/targetcategory = 0
/targetformat = ""
/sumRTcorrect_1 = 0
/sumRT_1 = 0
/sumRTcorrect_2 = 0
/sumRT_2 = 0
/sumRTcorrect_3 = 0
/sumRT_3 = 0
/sumRTcorrect_4 = 0
/sumRT_4 = 0
/sumRTcorrect_5 = 0
/sumRT_5 = 0
/sumRTcorrect_6 = 0
/sumRT_6 = 0
/sumRTcorrect_7 = 0
/sumRT_7 = 0
/sumRTcorrect_8 = 0
/sumRT_8 = 0
/repeat = 0
/selectpracticepicture = 0
/starttime = 0
/endtime = 0
/expcondition = 0
/format1 = 0
/format2 = 0
/startheight_A = 0
/startheight_B = 0
/Maxheight = display.canvasheight
/mouse_y = 0
/completeRT = 0
/changedirection = 0
/mouse_change = 0
/trialcode = 0
/RT = 0
/correct = 0
/stimulus = 0
/initialresponse = ""
/finalresponse = ""
/response = 0
/completed = 0
</values>

<expressions >
/ AAT_Diffscore_Cat1 = if (values.expcondition == 1) trial.AAT_1.medianlatency - trial.AAT_2.medianlatency else
trial.AAT_2.medianlatency - trial.AAT_1.medianlatency
/ AAT_Diffscore_Cat2 = if (values.expcondition == 1) trial.AAT_3.medianlatency - trial.AAT_4.medianlatency else
trial.AAT_4.medianlatency - trial.AAT_3.medianlatency
/ AAT_Diffscore_Cat3 = if (values.expcondition == 1) trial.AAT_5.medianlatency - trial.AAT_6.medianlatency else
trial.AAT_6.medianlatency - trial.AAT_5.medianlatency
/ AAT_Diffscore_Cat4 = if (values.expcondition == 1) trial.AAT_7.medianlatency - trial.AAT_8.medianlatency else
trial.AAT_8.medianlatency - trial.AAT_7.medianlatency
/maxheightchange_px = if (values.targetformat == "l") {(values.Startheight_ratioA - values.MinHeight_ratioA) * values.Maxheight}
else {(values.Startheight_ratioB - values.MinHeight_ratioB) * values.Maxheight}
</expressions>

<picture targetstimulus>
/ items = targets
/ select = values.selectstimulus
/ position = (50%, 50%)
/ size = (100%, 100%)
/ erase = false
</picture>

<shape eraser>
/ shape = rectangle
/ color = white
/ size = (100%, 100%)
/ erase = false
</shape>

<text instructtext>
/items = trialstartinstructions
/select = 1
/position = (50%, 40%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
</text>

<text center>
/items = ("X")
/position = (50%, 50%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 1)
/ txcolor = (red)
</text>

<text error>
/ items = ("ERROR")
/ position = (50%, 50%)
/ fontstyle = ("Arial", 5%, true, false, false, false, 5, 0)
/ txcolor = (white)
/txbgcolor = (red)
</text>

<picture practicetarget>
/ items = practicestimuli
/ select = values.selectpracticepicture
/ position = (50%, 50%)
/ size = (100%, 100%)
/ erase = false
</picture>

<trial practicestartA>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.practicestartA.responsey]
/recorddata = false
/branch = [trial.practicetrial_a]
</trial>

<trial practicestartB>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.practicestartB.responsey]
/recorddata = false
/branch = [trial.practicetrial_b]
</trial>

<trial practicetrial_A>
/inputdevice = mouse
/ontrialbegin = [values.trialcode = "practicetrial_A"]
/ontrialbegin = [values.targetformat = "l"]
/ ontrialbegin = [values.selectpracticepicture = 1]
/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [picture.practicetarget.height = values.startheight_A]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = practicetarget]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.practicetrial_a.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.practicetrial_a.responsey < (values.mouse_y - values.pixeltolerance)) ]

/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_a.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.practicetrial_a.responsey > values.mouse_y)]
/ errormessage = true(error,0)

/ontrialend = [if (trial.practicetrial_a.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.practicetrial_a.responsey)]
/ ontrialend = [values.mouse_y = trial.practicetrial_a.responsey]

/ontrialend = [values.RT = trial.practicetrial_A.latency]
/ontrialend = [values.correct = trial.practicetrial_A.correct]
/ontrialend = [values.stimulus = picture.practicetarget.currentitem]
/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.practicedecrease else trial.practiceincrease]
/ recorddata = false
</trial>

<trial practicetrial_B>
/inputdevice = mouse
/ontrialend = [values.trialcode = "practicetrial_B"]
/ontrialbegin = [values.targetformat = "p"]
/ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.repeat = 0]
/ ontrialbegin = [values.selectpracticepicture = 2]
/ ontrialbegin = [picture.practicetarget.height = values.startheight_B]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = practicetarget]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.practicetrial_b.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.practicetrial_b.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_b.responsey > values.mouse_y) ||
(values.expcondition == 2 && trial.practicetrial_b.responsey < values.mouse_y)]
/ errormessage = true(error,0)

/ontrialend = [if (trial.practicetrial_b.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.practicetrial_b.responsey)]
/ ontrialend = [values.mouse_y = trial.practicetrial_b.responsey]

/ontrialend = [values.RT = trial.practicetrial_b.latency]
/ontrialend = [values.correct = trial.practicetrial_b.correct]
/ontrialend = [values.stimulus = picture.practicetarget.currentitem]
/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.practicedecrease else trial.practiceincrease]
/ recorddata = false
</trial>

<trial practicedecrease>
/inputdevice = mouse
/ontrialbegin = [if (values.expcondition == 1 && values.targetformat == "p") trial.practicedecrease.insertstimulustime(text.error, 0)]
/ontrialbegin = [if (values.expcondition == 2 && values.targetformat == "l") trial.practicedecrease.insertstimulustime(text.error, 0)]

/ ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height - values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/ stimulusframes = [1 = eraser, practicetarget]
/validresponse = (mousemove)

/ontrialend = [values.mouse_change = abs(values.mouse_y - trial.practicedecrease.responsey)]

/ontrialend = [trial.practicedecrease.resetstimulusframes()]


/branch = [if (script.subjectid == "monkey") {values.endtime = script.elapsedtime; values.finalresponse = "PUSH"; trial.intertrialinterval}]

/branch = [if (trial.practicedecrease.responsey <= 0)
{values.mouse_y = trial.practicedecrease.responsey; values.endtime = script.elapsedtime; values.finalresponse = "PUSH"; trial.enddecrease_practice}]
/branch = [if (trial.practicedecrease.responsey <= values.mouse_y)
{values.mouse_y = trial.practicedecrease.responsey; trial.practicedecrease}]
/branch = [if (trial.practicedecrease.responsey > values.mouse_y)
{values.mouse_y = trial.practicedecrease.responsey; values.changedirection += 1; trial.practiceincrease}]

/ recorddata = false
</trial>

<trial practiceincrease>
/inputdevice = mouse
/ontrialbegin = [if (values.expcondition == 1 && values.targetformat == "l") trial.practiceincrease.insertstimulustime(text.error, 0)]
/ontrialbegin = [if (values.expcondition == 2 && values.targetformat == "p") trial.practiceincrease.insertstimulustime(text.error, 0)]

/ ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height + values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/ stimulusframes = [1 = practicetarget]
/validresponse = (mousemove)
/ontrialend = [values.mouse_change = abs(values.mouse_y - trial.practiceincrease.responsey)]

/ontrialend = [trial.practiceincrease.resetstimulusframes()]

/branch = [if (script.subjectid == "monkey") {values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.intertrialinterval}]
/branch = [if (trial.practiceincrease.responsey >= values.maxheight-1)
{values.mouse_y = trial.practiceincrease.responsey; values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.endincrease_practice}]
/branch = [if (trial.practiceincrease.responsey >= values.mouse_y)
{values.mouse_y = trial.practiceincrease.responsey; trial.practiceincrease}]
/branch = [if (trial.practiceincrease.responsey < values.mouse_y)
{values.mouse_y = trial.practiceincrease.responsey; values.changedirection += 1; trial.practicedecrease}]
/recorddata = false
</trial>

<trial endincrease_practice>
/ ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height + values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/stimulusframes = [1 = practicetarget]
/timeout = 0
/branch = [trial.intertrialinterval]
/recorddata = false
</trial>

<trial enddecrease_practice>
/ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height - values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/stimulusframes = [1 = eraser, practicetarget]
/timeout = 0
/branch = [trial.intertrialinterval]
/recorddata = false
</trial>

<block practice_AAT>
/preinstructions = (intro, practice)
/ trials = [1-20 = noreplace(practicestartA, practicestartB)]
</block>

<text nextstimulus>
/ items = ("<%values.nextstimulus%>")
/ position = (50%, 60%)
/ fontstyle = ("Arial", 2.33%, false, false, false, false, 5, 0)
</text>

<trial AAT_start>
/ ontrialbegin = [values.nextstimulus = substring(values.sequence, values.index, 1);
values.index += 1]
/ ontrialbegin = [values.repeat = 0]
/ timeout = 0
/ branch = [if (values.nextstimulus == 1) trial.AAT_1_start]
/ branch = [if (values.nextstimulus == 2) trial.AAT_2_start]
/ branch = [if (values.nextstimulus == 3) trial.AAT_3_start]
/ branch = [if (values.nextstimulus == 4) trial.AAT_4_start]
/ branch = [if (values.nextstimulus == 5) trial.AAT_5_start]
/ branch = [if (values.nextstimulus == 6) trial.AAT_6_start]
/ branch = [if (values.nextstimulus == 7) trial.AAT_7_start]
/ branch = [if (values.nextstimulus == 8) trial.AAT_8_start]
/ recorddata = false
</trial>

<trial AAT_1_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_1_start.responsey]
/recorddata = false
/branch = [trial.AAT_1]
</trial>

<trial AAT_2_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_2_start.responsey]
/recorddata = false
/branch = [trial.AAT_2]
</trial>

<trial AAT_3_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_3_start.responsey]
/recorddata = false
/branch = [trial.AAT_3]
</trial>

<trial AAT_4_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_4_start.responsey]
/recorddata = false
/branch = [trial.AAT_4]
</trial>

<trial AAT_5_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_5_start.responsey]
/recorddata = false
/branch = [trial.AAT_5]
</trial>

<trial AAT_6_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_6_start.responsey]
/recorddata = false
/branch = [trial.AAT_6]
</trial>

<trial AAT_7_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_7_start.responsey]
/recorddata = false
/branch = [trial.AAT_7]
</trial>

<trial AAT_8_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/ontrialend = [values.mouse_y = trial.AAT_8_start.responsey]
/recorddata = false
/branch = [trial.AAT_8]
</trial>

<trial AAT_1>
/inputdevice = mouse
/ ontrialbegin = [values.trialcode = "AAT_1"]
/ ontrialbegin = [values.selectstimulus = list.category1.nextvalue]
/ ontrialbegin = [values.targetcategory = 1; values.targetformat = "l"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_1.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_1.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_1.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_1.responsey > values.mouse_y)]

/ ontrialend = [if (trial.AAT_1.correct) values.sumRTcorrect_1 += trial.AAT_1.latency]
/ ontrialend = [values.sumRT_1 += trial.AAT_1.latency]

/ontrialend = [if (trial.AAT_1.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_1.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_1.responsey]

/ ontrialend = [values.RT = trial.AAT_1.latency]
/ ontrialend = [values.correct = trial.AAT_1.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]
/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_2>
/inputdevice = mouse
/ ontrialbegin = [values.selectstimulus = list.category2.nextvalue]
/ ontrialbegin = [values.targetcategory = 1; values.targetformat = "p"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_B]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_2.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_2.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_2.responsey > values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_2.responsey < values.mouse_y)]

/ontrialend = [if (trial.AAT_2.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_2.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_2.responsey]

/ ontrialend = [if (trial.AAT_2.correct) values.sumRTcorrect_2 += trial.AAT_2.latency]
/ ontrialend = [values.sumRT_2 += trial.AAT_2.latency]

/ ontrialend = [values.trialcode = "AAT_2"]
/ ontrialend = [values.RT = trial.AAT_2.latency]
/ ontrialend = [values.correct = trial.AAT_2.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_3>
/inputdevice = mouse
/ ontrialbegin = [values.trialcode = "AAT_3"]
/ ontrialbegin = [values.selectstimulus = list.category3.nextvalue]
/ ontrialbegin = [values.targetcategory = 2; values.targetformat = "l"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_3.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_3.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_3.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_3.responsey > values.mouse_y)]

/ ontrialend = [if (trial.AAT_3.correct) values.sumRTcorrect_3 += trial.AAT_3.latency]
/ ontrialend = [values.sumRT_3 += trial.AAT_3.latency]

/ontrialend = [if (trial.AAT_3.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_3.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_3.responsey]

/ ontrialend = [values.RT = trial.AAT_3.latency]
/ ontrialend = [values.correct = trial.AAT_3.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]
/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_4>
/inputdevice = mouse
/ ontrialbegin = [values.selectstimulus = list.category4.nextvalue]
/ ontrialbegin = [values.targetcategory = 2; values.targetformat = "p"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_B]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_4.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_4.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_4.responsey > values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_4.responsey < values.mouse_y)]

/ontrialend = [if (trial.AAT_4.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_4.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_4.responsey]

/ ontrialend = [if (trial.AAT_4.correct) values.sumRTcorrect_4 += trial.AAT_4.latency]
/ ontrialend = [values.sumRT_4 += trial.AAT_4.latency]

/ ontrialend = [values.trialcode = "AAT_4"]
/ ontrialend = [values.RT = trial.AAT_4.latency]
/ ontrialend = [values.correct = trial.AAT_4.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_5>
/inputdevice = mouse
/ ontrialbegin = [values.trialcode = "AAT_5"]
/ ontrialbegin = [values.selectstimulus = list.category5.nextvalue]
/ ontrialbegin = [values.targetcategory = 3; values.targetformat = "l"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]
/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_5.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_5.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_5.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_5.responsey > values.mouse_y)]

/ ontrialend = [if (trial.AAT_5.correct) values.sumRTcorrect_5 += trial.AAT_5.latency]
/ ontrialend = [values.sumRT_5 += trial.AAT_5.latency]

/ontrialend = [if (trial.AAT_5.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_5.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_5.responsey]

/ ontrialend = [values.RT = trial.AAT_5.latency]
/ ontrialend = [values.correct = trial.AAT_5.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]
/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_6>
/inputdevice = mouse
/ ontrialbegin = [values.selectstimulus = list.category6.nextvalue]
/ ontrialbegin = [values.targetcategory = 3; values.targetformat = "p"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_B]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_6.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_6.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_6.responsey > values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_6.responsey < values.mouse_y)]

/ontrialend = [if (trial.AAT_6.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_6.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_6.responsey]

/ ontrialend = [if (trial.AAT_6.correct) values.sumRTcorrect_6 += trial.AAT_6.latency]
/ ontrialend = [values.sumRT_6 += trial.AAT_6.latency]

/ ontrialend = [values.trialcode = "AAT_6"]
/ ontrialend = [values.RT = trial.AAT_6.latency]
/ ontrialend = [values.correct = trial.AAT_6.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_7>
/inputdevice = mouse
/ ontrialbegin = [values.trialcode = "AAT_7"]
/ ontrialbegin = [values.selectstimulus = list.category7.nextvalue]
/ ontrialbegin = [values.targetcategory = 4; values.targetformat = "l"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_7.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_7.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_7.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_7.responsey > values.mouse_y)]

/ ontrialend = [if (trial.AAT_7.correct) values.sumRTcorrect_7 += trial.AAT_7.latency]
/ ontrialend = [values.sumRT_7 += trial.AAT_7.latency]

/ontrialend = [if (trial.AAT_7.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_7.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_7.responsey]

/ ontrialend = [values.RT = trial.AAT_7.latency]
/ ontrialend = [values.correct = trial.AAT_7.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]
/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>


<trial AAT_8>
/ ontrialbegin = [values.selectstimulus = list.category8.nextvalue]
/ ontrialbegin = [values.targetcategory = 4; values.targetformat = "p"]
/ ontrialbegin = [picture.targetstimulus.height = values.startheight_B]

/ ontrialbegin = [values.starttime = script.elapsedtime; values.endtime = 0]
/ ontrialbegin = [values.completeRT = 0; values.changedirection = 0; values.finalresponse=""]

/ stimulusframes = [1 = targetstimulus]
/ validresponse = (mousemove)
/isvalidresponse = [(trial.AAT_8.responsey > (values.mouse_y + values.pixeltolerance)) ||
(trial.AAT_8.responsey < (values.mouse_y - values.pixeltolerance)) ]
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_8.responsey > values.mouse_y) ||
(values.expcondition == 2 && trial.AAT_8.responsey < values.mouse_y)]

/ontrialend = [if (trial.AAT_8.responsey < values.mouse_y) values.response = 1 else values.response = 2]
/ ontrialend = [values.mouse_change = abs(values.mouse_y - trial.AAT_8.responsey)]
/ ontrialend = [values.mouse_y = trial.AAT_8.responsey]

/ ontrialend = [if (trial.AAT_8.correct) values.sumRTcorrect_8 += trial.AAT_8.latency]
/ ontrialend = [values.sumRT_8 += trial.AAT_8.latency]

/ ontrialend = [values.trialcode = "AAT_8"]
/ ontrialend = [values.RT = trial.AAT_8.latency]
/ ontrialend = [values.correct = trial.AAT_8.correct]
/ ontrialend = [values.stimulus = picture.targetstimulus.currentitem]

/ontrialend = [if (values.response == 1) values.initialresponse = "PUSH"
else values.initialresponse = "PULL"]

/ branch = [if (values.response == 1) trial.decrease else trial.increase]
/recorddata = false
</trial>

<trial decrease>
/inputdevice = mouse
/ ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height - values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]

/ stimulusframes = [1 = eraser, targetstimulus]
/validresponse = (mousemove)
/ontrialend = [values.mouse_change = abs(values.mouse_y - trial.decrease.responsey)]

/ontrialend = [trial.decrease.resetstimulusframes()]

/branch = [if (script.subjectid == "monkey") {values.endtime = script.elapsedtime; values.finalresponse = "PUSH"; trial.intertrialinterval}]

/branch = [if (trial.decrease.responsey <= 1)
{values.mouse_y = trial.decrease.responsey; values.endtime = script.elapsedtime; values.finalresponse = "PUSH"; trial.enddecrease}]
/branch = [if (trial.decrease.responsey <= values.mouse_y)
{values.mouse_y = trial.decrease.responsey; trial.decrease}]
/branch = [if (trial.decrease.responsey > values.mouse_y)
{values.mouse_y = trial.decrease.responsey; values.changedirection += 1; trial.increase}]

/ recorddata = false
</trial>


<trial increase>
/ ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height + values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/ stimulusframes = [1 = targetstimulus]
/validresponse = (mousemove)
/ontrialend = [values.mouse_change = abs(values.mouse_y - trial.increase.responsey)]

/ontrialend = [trial.increase.resetstimulusframes()]

/branch = [if (script.subjectid == "monkey") {values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.intertrialinterval}]

/branch = [if (trial.increase.responsey >= values.maxheight-1)
{values.mouse_y = trial.increase.responsey; values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.endincrease}]
/branch = [if (trial.increase.responsey >= values.mouse_y)
{values.mouse_y = trial.increase.responsey; trial.increase}]
/branch = [if (trial.increase.responsey < values.mouse_y)
{values.mouse_y = trial.increase.responsey; values.changedirection += 1; trial.decrease}]
/recorddata = false
</trial>

<trial endincrease>
/ ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height + values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/stimulusframes = [1 = targetstimulus]
/timeout = 0
/branch = [trial.intertrialinterval]
/recorddata = false
</trial>

<trial enddecrease>
/ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height - values.mouse_change/(values.maxheight/2) * expressions.maxheightchange_px]
/stimulusframes = [1 = eraser, targetstimulus]
/timeout = 0
/branch = [trial.intertrialinterval]
/recorddata = false
</trial>


<trial InterTrialInterval>
/ontrialbegin = [values.completeRT= values.endtime - values.starttime]
/ stimulusframes = [1 = eraser]
/ timeout = values.intertrialinterval
/ recorddata = true
</trial>


<block AAT>
/preinstructions = (taskinstructions)
/ onblockbegin = [values.index = 0]
/ trials = [1-80 = AAT_start]
</block>


<expt >
/ onexptbegin = [values.expcondition = 1]
/ onexptbegin = [values.format1 = "PORTRAIT"; values.format2 = "LANDSCAPE"]
/ subjects = (1 of 2)
/groupassignment = groupnumber
/ onexptbegin = [values.startheight_A = values.Startheight_ratioA*values.maxheight]
/ onexptbegin = [values.startheight_B = values.Startheight_ratioB* values.maxheight]
/ blocks = [1 = SequenceGenerator; 2 = practice_AAT; 3 = AAT]
/ postinstructions = (End)
/onexptend = [values.completed = 1]
</expt>

<expt >
/ onexptbegin = [values.expcondition = 2]
/ onexptbegin = [values.format2 = "PORTRAIT"; values.format1 = "LANDSCAPE"]
/ subjects = (2 of 2)
/groupassignment = groupnumber
/ onexptbegin = [values.startheight_A = values.Startheight_ratioA*values.maxheight]
/ onexptbegin = [values.startheight_B = values.Startheight_ratioB*values.maxheight]
/ blocks = [1 = SequenceGenerator; 2 = practice_AAT; 3 = AAT]
/ postinstructions = (End)
/onexptend = [values.completed = 1]
</expt>


<values>
/count1 = 10
/count2 = 10
/count3 = 10
/count4 = 10
/count5 = 10
/count6 = 10
/count7 = 10
/count8 = 10
/runcount_1 = 0
/runcount_2 = 0
/runcount_3 = 0
/runcount_4 = 0
/runcount_A = 0
/runcount_B = 0
/newnumber = 0
/count_comparecat = 0
/count_compareformat = 0
/sequence = ""
/index = 0
</values>


<list stimcats>
/ items = (
1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8)
/ replace = false
</list>


<trial selectnumber>
/ ontrialbegin = [values.newnumber = list.stimcats.nextvalue]
/ ontrialbegin = [values.index += 1]
/ ontrialbegin = [if (values.newnumber == 1)
{values.runcount_1 += 1;
values.runcount_A += 1;
values.count_comparecat = values.runcount_1;
values.count_compareformat = values.runcount_A;
values.count1 -=1}]
/ ontrialbegin = [if (values.newnumber ==2)
{values.runcount_1 += 1;
values.runcount_B += 1;
values.count_comparecat = values.runcount_1;
values.count_compareformat = values.runcount_B;
values.count2 -=1}]
/ ontrialbegin = [if (values.newnumber ==3)
{values.runcount_2 += 1;
values.runcount_A += 1;
values.count_comparecat = values.runcount_2;
values.count_compareformat = values.runcount_A;
values.count3 -= 1}]
/ ontrialbegin = [if (values.newnumber ==4)
{values.runcount_2 += 1;
values.runcount_B += 1;
values.count_comparecat = values.runcount_2;
values.count_compareformat = values.runcount_B;
values.count4 -=1}]
/ ontrialbegin = [if (values.newnumber ==5)
{values.runcount_3 += 1;
values.runcount_A += 1;
values.count_comparecat = values.runcount_3;
values.count_compareformat = values.runcount_A;
values.count5 -= 1}]
/ ontrialbegin = [if (values.newnumber ==6)
{values.runcount_3 += 1;
values.runcount_B += 1;
values.count_comparecat = values.runcount_3;
values.count_compareformat = values.runcount_B;
values.count6 -= 1}]
/ ontrialbegin = [if (values.newnumber == 7)
{values.runcount_4 += 1;
values.runcount_A += 1;
values.count_comparecat = values.runcount_4;
values.count_compareformat = values.runcount_A;
values.count7 -= 1}]
/ ontrialbegin = [if (values.newnumber ==8)
{values.runcount_4 += 1;
values.runcount_B += 1;
values.count_comparecat = values.runcount_4;
values.count_compareformat = values.runcount_B;
values.count8 -= 1}]

/ontrialend = [if (values.count_comparecat < 4 && values.count_compareformat < 4)
{ values.sequence = concat(values.sequence, values.newnumber)}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 1)
{ values.runcount_2 = 0; values.runcount_3 = 0; values.runcount_4 = 0; values.runcount_B = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 2)
{ values.runcount_2 = 0; values.runcount_3 = 0; values.runcount_4 = 0; values.runcount_A = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 3)
{ values.runcount_1 = 0; values.runcount_3 = 0; values.runcount_4 = 0; values.runcount_B = 0;
trial.selectnumber}]

/ branch = [if (values.index <= values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 4)
{ values.runcount_1 = 0; values.runcount_3 = 0; values.runcount_4 = 0; values.runcount_A = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 5)
{ values.runcount_2 = 0; values.runcount_1 = 0; values.runcount_4 = 0; values.runcount_B = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 6)
{ values.runcount_2 = 0; values.runcount_1 = 0; values.runcount_4 = 0; values.runcount_A = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 7)
{ values.runcount_2 = 0; values.runcount_3 = 0; values.runcount_1 = 0; values.runcount_B = 0;
trial.selectnumber}]

/ branch = [if (values.index < values.totaltrialcount && values.count_comparecat < 4 && values.count_compareformat < 4 && values.newnumber == 8)
{ values.runcount_2 = 0; values.runcount_3 = 0; values.runcount_1 = 0; values.runcount_A = 0;
trial.selectnumber}]

/branch = [if (values.newnumber == 1 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count5 != 0 || values.count6 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1; list.stimcats.insertitem(1, 1); values.runcount_1 -= 1; values.runcount_a -= 1; values.count1 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 1 && values.count_compareformat > 3 &&
(values.count2 != 0 || values.count4 != 0 || values.count6 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(1, 1); values.runcount_1 -= 1; values.runcount_a -= 1; values.count1 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 2 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count5 != 0 || values.count6 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(2, 1); values.runcount_1 -= 1; values.runcount_b -= 1; values.count2 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 2 && values.count_compareformat > 3 &&
(values.count1 != 0 || values.count3 != 0 || values.count5 != 0 || values.count7 != 0))
{values.index -= 1;list.stimcats.insertitem(2, 1); values.runcount_1 -= 1; values.runcount_b -= 1; values.count2 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 3 && values.count_comparecat > 3 &&
(values.count1 != 0 || values.count2 != 0 || values.count5 != 0 || values.count6 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(3, 1); values.runcount_2 -= 1; values.runcount_a -= 1; values.count3 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 3 && values.count_compareformat > 3 &&
(values.count2 != 0 || values.count4 != 0 || values.count6 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(3, 1); values.runcount_2 -= 1; values.runcount_a -= 1; values.count3 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 4 && values.count_comparecat > 3 &&
(values.count1 != 0 || values.count2 != 0 || values.count5 != 0 || values.count6 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(4, 1); values.runcount_2 -= 1; values.runcount_b -= 1; values.count4 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 4 && values.count_compareformat > 3 &&
(values.count1 != 0 || values.count3 != 0 || values.count5 != 0 || values.count7 != 0))
{values.index -= 1;list.stimcats.insertitem(4, 1); values.runcount_2 -= 1; values.runcount_b -= 1; values.count4 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 5 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count1 != 0 || values.count2 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(5, 1); values.runcount_3 -= 1; values.runcount_a -= 1; values.count5 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 5 && values.count_compareformat > 3 &&
(values.count2 != 0 || values.count4 != 0 || values.count6 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(5, 1); values.runcount_3 -= 1; values.runcount_a -= 1; values.count5 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 6 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count1 != 0 || values.count2 != 0 || values.count7 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(6, 1); values.runcount_3 -= 1; values.runcount_b -= 1; values.count6 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 6 && values.count_compareformat > 3 &&
(values.count1 != 0 || values.count3 != 0 || values.count5 != 0 || values.count7 != 0))
{values.index -= 1;list.stimcats.insertitem(6, 1); values.runcount_3 -= 1; values.runcount_b -= 1; values.count6 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 7 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count1 != 0 || values.count2 != 0 || values.count5 != 0 || values.count6 != 0))
{values.index -= 1;list.stimcats.insertitem(7, 1); values.runcount_4 -= 1; values.runcount_a -= 1; values.count7 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 7 && values.count_compareformat > 3 &&
(values.count2 != 0 || values.count4 != 0 || values.count6 != 0 || values.count8 != 0))
{values.index -= 1;list.stimcats.insertitem(7, 1); values.runcount_4 -= 1; values.runcount_a -= 1; values.count7 += 1; trial.selectnumber}]

/branch = [if (values.newnumber == 8 && values.count_comparecat > 3 &&
(values.count3 != 0 || values.count4 != 0 || values.count1 != 0 || values.count2 != 0 || values.count5 != 0 || values.count5 != 0))
{values.index -= 1;list.stimcats.insertitem(8, 1); values.runcount_4 -= 1; values.runcount_b -= 1; values.count8 += 1; trial.selectnumber}]
/branch = [if (values.newnumber == 8 && values.count_compareformat > 3 &&
(values.count1 != 0 || values.count3 != 0 || values.count5 != 0 || values.count7 != 0))
{values.index -= 1;list.stimcats.insertitem(8, 1); values.runcount_4 -= 1; values.runcount_b -= 1; values.count8 += 1; trial.selectnumber}]

/branch = [if (values.count_comparecat > 3 || values.count_compareformat > 3)
{values.sequence = "";
values.index = 0;
values.runcount_1 = 0; values.runcount_2 = 0; values.runcount_3 = 0; values.runcount_4 = 0;
values.runcount_A = 0; values.runcount_B = 0;
values.count1 = 10; values.count2 = 10; values.count3 = 10; values.count4 = 10; values.count5 = 10; values.count6 = 10; values.count7 = 10; values.count8 = 10;
list.stimcats.reset(); trial.selectnumber}]

/timeout = 0
/recorddata = false
</trial>


<text completesequence>
/ items = ("<%values.sequence%>")
</text>

<trial showsequence>
/ inputdevice = keyboard
/ stimulusframes = [1 = completesequence]
/ validresponse = (57)
</trial>


<text wait>
/items = ("Please wait; we'll be ready shortly")
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 0)
</text>

<block SequenceGenerator>
/ bgstim = (wait)
/ trials = [1 = selectnumber]
/ recorddata = false
</block>
By Dave - 2/22/2015

> I looked at the stimuli linking forum you connected me to. It only connects to text stimuli though

No. It applies to *all* kinds of stimuli. Anyway, here's what you do.

(1) Add

<text triggerwarning>
/ items = ("TRIGGER WARNING!", "")
/ txcolor = (red)
/ select = values.warning
</text>

and

<values>
/warning = 1
</values>

to the script.

(2) Change <trial AAT_start> to


<trial AAT_start>
/ ontrialbegin = [values.nextstimulus = substring(values.sequence, values.index, 1);
values.index += 1]
/ ontrialbegin = [values.repeat = 0]
/ timeout = 0
/ branch = [if (values.nextstimulus == 1) {values.warning=1; trial.AAT_1_start}]
/ branch = [if (values.nextstimulus == 2) {values.warning=1; trial.AAT_2_start}]
/ branch = [if (values.nextstimulus == 3) {values.warning=1; trial.AAT_3_start}]
/ branch = [if (values.nextstimulus == 4) {values.warning=1; trial.AAT_4_start}]
/ branch = [if (values.nextstimulus == 5) {values.warning=2; trial.AAT_5_start}]
/ branch = [if (values.nextstimulus == 6) {values.warning=2; trial.AAT_6_start}]
/ branch = [if (values.nextstimulus == 7) {values.warning=2; trial.AAT_7_start}]
/ branch = [if (values.nextstimulus == 8) {values.warning=2; trial.AAT_8_start}]

/ recorddata = false
</trial>

(3) Add

/responsemessage = (center, triggerwarning, 20)

to <trial AAT_1_start> to <AAT_8_start>

<trial AAT_1_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/responsemessage = (center, triggerwarning, 20)
/ontrialend = [values.mouse_y = trial.AAT_1_start.responsey]
/recorddata = false
/branch = [trial.AAT_1]
</trial>

<trial AAT_2_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/responsemessage = (center, triggerwarning, 20)
/ontrialend = [values.mouse_y = trial.AAT_2_start.responsey]
/recorddata = false
/branch = [trial.AAT_2]
</trial>
...
<trial AAT_8_start>
/inputdevice = mouse
/stimulusframes = [1 = instructtext, center]
/validresponse = (center)
/responsemessage = (center, triggerwarning, 20)
/ontrialend = [values.mouse_y = trial.AAT_8_start.responsey]
/recorddata = false
/branch = [trial.AAT_8]
</trial>
By acarnegie - 2/24/2015

Okay, I got that to work. Thank you so much.

Now say for each individual stimuli of the grouping that I want to be preceded by the text "trigger warning", I want it to be different for each one (i.e., for 1_A_L.jpg I want it to say "trigger warning: animal cruelty" and for 1_G_L.jpg I want it to say "trigger warning: gore"). How would I go about editing it that specifically?

-Amanda
By Dave - 2/24/2015

You essentially do it as described in the "How to display stimulus pairs" topic in the documentation.

Work through the script and pay particular attention to how / where values.selectstimulus is set (i.e. where an item number is selected from one of the various <list> elements and stored in that value). You need to (1) move this to an earlier <trial>, e.g. <trial AAT_start> and (2) use that value for stimulus selection in your "warning" <text> element as well as

<picture targetstimulus>
/ items = targets
/ select = values.selectstimulus
/ position = (50%, 50%)
/ size = (100%, 100%)
/ erase = false
</picture>
By acarnegie - 3/3/2015

Okay, I've decided against doing what I had asked to do in my last post. Instead, for the second condition, I would like to randomize these warnings to appear or not appear equally thoughout all stimuli (i.e., all 80, the ones starting with both 1_... and 2_...), so appearing 40 times total. How would I go about doing this?

Thank you so much,
-Amanda
By Dave - 3/3/2015

Add a <list> to the script that contains the values 1 and 2 80 times.

<list warninglist>
/ items = (1,2)
/ poolsize = 80
<list>

Sample a random value from that list in <trial AAT_start>

<trial AAT_start>
/ ontrialbegin = [values.nextstimulus = substring(values.sequence, values.index, 1);
values.index += 1]
/ ontrialbegin = [values.repeat = 0]
/ timeout = 0
/ branch = [if (values.nextstimulus == 1) {values.warning=list.warninglist.nextvalue; trial.AAT_1_start}]
/ branch = [if (values.nextstimulus == 2) {values.warning=
list.warninglist.nextvalue; trial.AAT_2_start}]
/ branch = [if (values.nextstimulus == 3) {values.warning=
list.warninglist.nextvalue; trial.AAT_3_start}]
/ branch = [if (values.nextstimulus == 4) {values.warning=
list.warninglist.nextvalue; trial.AAT_4_start}]
/ branch = [if (values.nextstimulus == 5) {values.warning=
list.warninglist.nextvalue; trial.AAT_5_start}]
/ branch = [if (values.nextstimulus == 6) {values.warning=
list.warninglist.nextvalue; trial.AAT_6_start}]
/ branch = [if (values.nextstimulus == 7) {values.warning=
list.warninglist.nextvalue; trial.AAT_7_start}]
/ branch = [if (values.nextstimulus == 8) {values.warning=
list.warninglist.nextvalue; trial.AAT_8_start}]
/ recorddata = false
</trial>
By acarnegie - 3/4/2015

Great thank you that worked. One last question, how to I make the text stimuli appear for a longer time before the image appears? 
By Dave - 3/4/2015

Increase the duration in the /responsemessage attributes in  <trial AAT_1_start> to <AAT_8_start> as needed.
By acarnegie - 3/5/2015

As of right now, it says /responsemessage = (center, triggerwarning, 20), do I change the "20" to a larger number (i.e., is that connoting millisecond duration?)
By Dave - 3/5/2015

Yes, that is precisely correct.