Flanker task help URGENT


Author
Message
Tobiii
Tobiii
Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 24
Hi guys I am currently working on a flanker task that uses three different picture stimuli instead of two in the original study. However, I am unable to get response keys to fit each corresponding picture? Can someone please look through my code and see what I have done wrong?? This is urgent for me and I need it done by today. PLEASE HELP!!


*******************************************************************************************************************
*******************************************************************************************************************
CHILD FLANKER TEST
*******************************************************************************************************************
*******************************************************************************************************************
Script Info

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 02-25-2014

last updated: 02-26-2014 by K.Borchert for Millisecond Software LLC

Copyright © 02-26-2014 Millisecond Software
*******************************************************************************************************************
*******************************************************************************************************************
BACKGROUND INFO
*******************************************************************************************************************
*******************************************************************************************************************
*SCRIPT PURPOSE*

This script implements a basic Flanker Test for children as described in:

Christ, S.E., Kester, L.E., Bodner, K.E. & Miles, J.H. (2011). Evidence for Selective Inhibitory Impairment in Individuals
With Autism Spectrum Disorder. Neuropsychology, 25, 690–701.


*TASK*
Participants are presented 5 fish in one row and are instructed to pay attention to the center fish (target).
If the center fish looks to the right, participants are instructed to press a specific response key.
If the center fish looks to the left, participants are instructed to press a different response key.
The fish flanking the middle fish (the flankers) can either look in the same (compatible) or the
opposite direction (incompatible) than the target/center fish (Note: the flanker fish always look in the same direction).


*SCRIPT SPECIFICS*

(1) EDITABLE CODE:
Check under EDITABLE CODE for (relatively) easily editable values, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to
further customize your experiment.

If you have any questions, please don't hesitate to contact Millisecond Software.

(2) EXPERIMENTAL SET-UP
2 congruence (congruent vs incongruent) x 2 target directions (right vs left) tested within participants

1. Practice Block: 20 trials with only targets (10 left, 10 right, randomly sampled)
2. Practice Block: 20 trials with targets and flankers (5 congruent_left, 5 congruent_right, 5 incongruent_right, 5 incongruent_left,
randomly sampled)
3. Test Block: 120 trials with targets and flankers (all 4 conditions equally often, randomly sampled)
=> number of trials can be edited under EDITABLE CODE -> Editable Values

Trial Sequence:
1. trial.flanker: trialduration max. 3000ms (default, editable)
-> trial terminates immediately after a given response or after max trialduration.

!!Note: to adjust the size of the 5 fish on your monitor, go to EDITABLE CODE -> Editable Values and edit
values.pictureheight and/or values.flankerdistance

2. (trial.errorfeedback): if errors occurred; error trialduration editable
Errors:
a) Anticipatory response: responses faster than values.anticipatoryresponselatency (default: 200ms, editable value)
b) Too slow: no response occuring before values.max_trialduration (default: 3000ms = max trialduration of trial.flanker, editable value)
c) Wrong Response: incorrect response key was pressed

Error feedback is presented in a visual (text that specifies the specific error) and auditory form (sound file).

3. trial.iti: trialduration 1500ms (default, editable)
4. (trial.rest): if number of trials indicate that a rest trial should be presented (default: after 40 trials, editable)

(3) STIMULI
Fish stimuli are used from the ChildANT.iqx script (the fish were originally downloaded from:
http://www.sacklerinstitute.org/cornell/assays_and_tools/)

(4) INSTRUCTIONS
Instructions are not original. They can easily be edited under EDITABLE CODE -> Editable Instructions

(5) DATA
Check under DATA for data file information - customize if necessary

*******************************************************************************************************************
*******************************************************************************************************************
EDITABLE CODE: The code in this section can be easily altered (look for additional instructions were indicated)
*******************************************************************************************************************
*******************************************************************************************************************

***************************************************************************************
*********************************************
Editable Values
*********************************************
***************************************************************************************

Responsekeys:
/responsekey_targethappy:scancode of the response key for happy face (default: 52)
/responsekeytargethappy_label:description of the response key for happy face
/responsekey_targetsad:  scancode of the response key for sad face (default: 51)
/responsekeytargetsad_label:description of the response key sad face
/responsekey_targetneutral:scancode of the response key for neutral face (default: 50)
/responsekeytargetneutral_label:description of the response key for neutral face

Fish presentation:
/pictureheight:determines the size/height in screen height % of the individual fish pictures (default: 10%)
/flankerdistance:determines the distance in screen width % between flankers (default: 10%)
Note: change these parameters to optimize the fish presentation on your screen

/errorfeedbackheight:determines the height of the feedback text in screen height (default: 5%)

Trialnumbers:
/numberofpracticetrials:determines the number of practice trials in each practice blocks (default: 20)
/numberoftrials:determines the number of test trials (default: 160)
Note: list.trialtype controls the distribution of congruent/incongruent trials
by default, the same number of congruent right, incongruent right, congruent left, incongruent left
trials are run.
/resttrial:determines the number of trials after which a rest trial is presented

Trialdurations:
/max_trialduration:the maximum trial duration of the flanker presentation (default: 3000ms)
/iti:the duration of the intertrial interval - time between response and next presentation
OR time between offset of errorfeedback and next presentation (default: 1500ms)
/errorfeedbackduration:duration of error feedback (default: 1000ms)
/restduration:duration of rest trial (default: 60000ms)

/anticipatoryresponselatency:all response latencies lower than this value will be categorized as "anticipatory responses" (default: 200ms)


<values>
/responsekey_targetright = 52
/responsekeytargetright_label = ">"
/responsekey_targetleft = 51
/responsekeytargetleft_label = "<"
/responsekey_targetup = 38
/responsekeytargetup_label = "l"

/pictureheight = 10%
/flankerdistance = 10%

/errorfeedbackheight = 5%

/numberofpracticetrials = 20
/numberoftrials = 120
/resttrial = 40

/max_trialduration = 3000
/iti = 1500
/errorfeedbackduration = 1000
/restduration = 60000

/anticipatoryresponselatency = 200
</values>


***************************************************************************************
*********************************************
Editable Stimuli
*********************************************
***************************************************************************************
<item face>
/1 = "Untitled.png"
/2 = "Untitled2.png"
/3 = "Untitled3.png"
</item>

<item errorfeedback>
/1 = "Early Response"
/2 = "Too slow"
/3 = "Wrong Response"
</item>


<item restinstructions>
/1 = "Take a rest"
</item>

***************************************************************************************
*********************************************
Editable Instructions
*********************************************
***************************************************************************************
<instruct>
/windowsize = (90%, 90%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ txcolor = (black)
/ finishlabel = "Press <Spacebar> to continue"
/nextkey = (57)
/nextlabel = "Press <Spacebar> to continue"
/prevkey = (28)
/prevlabel = "Press <Enter> to go back"
</instruct>

<page intro>
Welcome!
^^^In this experiment you will be presented 3 faces in a row. You will be asked to pay attention to whether the center face is happy, sad or neutral.
^^^^^Press <SPACEBAR> to continue to some practice.
</page>

<page practice1>
This is a practice session.
^^In this practice session you will be presented with 1 face in the center of your computer screen.
^Pay attention to whether this face is happy, sad or neutral.
^^^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.

^***************************************************************************************
^^It's important that you press the button as fast as you can without making many errors.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start.
</page>

<page practice2>
This is a second practice session.
^^In this practice session you will be presented with 3 faces in a row.
^^Just like during the first practice session pay attention only to the MIDDLE FACE in the center of the screen and
try to ignore the face to either side of the center face.
^^^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.
^***************************************************************************************
^^The face to either side of the center face might look in the same or different from the center face.
Try to ignore them when doing this task.
^^Just like before it's important that you press the button as fast as you can without making many errors.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start the next practice sessions.
</page>

<page testintro>
Practice is over now and the actual task is about to start.
^^The actual task is exactly the same as you have just practiced:
^You will be presented with 3 faces in a row. Pay attention only to the MIDDLE FACE in the center of the screen and
try to ignore the face to either side of the center face.
^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.
^***************************************************************************************
^^The face to either side of the center face might look in the same or different from the center face.
Try to ignore them when doing this task.
^^Just like before it's important that you press the button as fast as you can without making many errors.
^^The actual task is going to be longer than the practice session. You will be given a couple of breaks.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start.
</page>

<page end>
You have reached the end of the study. Thank you for your participation!
</page>


*******************************************************************************************************************
*******************************************************************************************************************
DATA: this section contains data file information
*******************************************************************************************************************
*******************************************************************************************************************

********************
raw data
********************
date, time, subject:date and time script was run with the current subjectnumber
blockcode, blocknum:the name and number of the current block
trialcode, trialnum: the name and number of the currently recorded trial
(Note: not all trials that are run might record data)
/trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
/congruence:stores the congruence of the target and flankers (congruent vs incongruent)
/targetdirection:stores the direction of the target fish (targethappy vs targetsad vs targetneutral)
stimulusitem:the presented stimuli in order of trial presentation
response:the participant's response (scancode)
/response:stores the response category depending on latency and response key used ("anticipatory", "valid", "too slow", "wrong response")
correct:the correctness of the response
latency: the response latency


<data>
/file = "ChildFlanker_rawdata.iqdat"
/columns = [date, time, subject, group, blockcode, blocknum, trialcode, trialnum, values.trialtype, values.congruence,
values.targetdirection,
stimulusitem, stimulusitem, stimulusitem,
response, values.response, correct, latency]
/separatefiles = true
</data>


********************
summary data
********************
/percenterrors_c: percent errors in congruent trials (test only)
/percenterrors_i:percent errors in incongruent trials (test only)
/meanRT_cc:mean latency of correct responses in congruent trials
/meanRT_ci:mean latency of correct responses in incongruent trials

<summarydata >
/file = "ChildFlanker_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.groupid,
expressions.percenterrors_c, expressions.percenterrors_i,
expressions.meanrt_cc, expressions.meanrt_ci]
</summarydata>


*******************************************************************************************************************
*******************************************************************************************************************
REMAINING CODE: Customize after careful consideration only
*******************************************************************************************************************
*******************************************************************************************************************

*******************************************************************************************************************
*******************************************************************************************************************
DEFAULTS:
*******************************************************************************************************************
*******************************************************************************************************************
requires Inquisit 4.0.5.0

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

*******************************************************************************************************************
*******************************************************************************************************************
VALUES: automatically updated
*******************************************************************************************************************
*******************************************************************************************************************
/selecttarget:determines which face is selected for the target (happy vs sad vs neutral)
/selectflanker:determines which faces are selected for the flankers (happy vs sad vs neutral)
/selecterrorfeedback:determines the error feedback text
/trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
/count_itis:counts the number of intertrial intervals (used to stop each block)

/targetdirection:stores the direction of the target fish (targethappy vs targetsad vs targetneutral)
/congruence:stores the congruence of the target and flankers (congruent vs incongruent)
/response:stores the response category ("anticipatory", "valid", "too slow", "wrong response")
Note: correct and incorrec tresponses that are "anticipatory" are both categorized as "anticipatory"

<values>
/selecttarget = 1
/selectflanker = 1
/selecterrorfeedback = 1
/trialtype = 0
/count_itis = 0

/targetdirection = ""
/congruence = ""
/response = ""
</values>

Summary Variables:
/count_congruent:counts all congruent trials (test only)
/count_incongruent:counts all incongruent trials (test only)

/count_correctcongruent:counts the number of congruent trials with a correct response (test only)
/count_correctincongruent:counts the number of incongruent trials with a correct response (test only)
/sumrt_correctcongruent:sums up the latencies of all correct congruent trials (test only)
/sumrt_correctincongruent:sums up the latencies of all correct incongruent trials (test only)

<values>
/count_congruent = 0
/count_incongruent = 0
/count_correctcongruent = 0
/count_correctincongruent = 0
/sumrt_correctcongruent = 0
/sumrt_correctincongruent = 0
</values>

*******************************************************************************************************************
*******************************************************************************************************************
EXPRESSIONS
*******************************************************************************************************************
*******************************************************************************************************************
/percenterrors_c: percent errors in congruent trials (test only)
/percenterrors_i:percent errors in incongruent trials (test only)
/meanRT_cc:mean latency of correct responses in congruent trials
/meanRT_ci:mean latency of correct responses in incongruent trials

<expressions>
/percenterrors_c = (1 - (values.count_correctcongruent/values.count_congruent)) * 100
/percenterrors_i = (1 - (values.count_correctincongruent/values.count_incongruent)) * 100
/meanRT_cc = values.sumrt_correctcongruent/values.count_correctcongruent
/meanRT_ci = values.sumrt_correctincongruent/values.count_correctincongruent
</expressions>

*******************************************************************************************************************
*******************************************************************************************************************
STIMULI
*******************************************************************************************************************
*******************************************************************************************************************

<picture flanker1>
/items = face
/select = values.selectflanker
/position = (picture.target.hposition - 2*values.flankerdistance, 50%)
/size = (100%, values.pictureheight)
</picture>

*the center face = target
<picture target>
/items = face
/select = values.selecttarget
/position = (50%, 50%)
/size = (100%, values.pictureheight)
</picture>

<picture flanker2>
/items = face
/select = values.selectflanker
/position = (picture.target.hposition + 2*values.flankerdistance, 50%)
/size = (100%, values.pictureheight)
</picture>





***********************
Stimuli for Errorfeedback
***********************
<text errorfeedback>
/items = errorfeedback
/select = values.selecterrorfeedback
/position = (50%, 50%)
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
/ txcolor = (red)
</text>



***********************
Stimuli for Resttrial
***********************
<text rest>
/items = restinstructions
/select = 1
/position = (50%, 30%)
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
/ txcolor = (black)
</text>

<clock restclock>
/ mode = timer
/ resetrate = trial
/ txcolor = yellow
/ txbgcolor = black
/ timeout = values.restduration
/ position = (50%, 50%)
/ format = "mm:ss"
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
</clock>4

*******************************************************************************************************************
*******************************************************************************************************************
LISTS
*******************************************************************************************************************
*******************************************************************************************************************
trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
all lists sample a trialtype randomly without replacement for as many trials as specified by
values.numberoftrials/values.numberofpracticetrials. By default all trialtypes
are sampled equally often.

<list trialtype_practice1>
/items = (1, 3, 5)
/replace = false
/poolsize = values.numberofpracticetrials
/resetinterval = 1
</list>

<list trialtype_practice2>
/items = (1, 2, 3, 4, 5, 6)
/replace = false
/poolsize = values.numberofpracticetrials
/resetinterval = 1
</list>

<list trialtype>
/items = (1, 2, 3, 4, 5, 6)
/replace = false
/poolsize = values.numberoftrials
/resetinterval = 1
</list>

*******************************************************************************************************************
*******************************************************************************************************************
TRIALS
*******************************************************************************************************************
*******************************************************************************************************************

Note:
* trial used for practice1 => only targets are presented (no flankers)
* selects the next target based on list.trialtype_practice1
* based on response either trial.errorfeedback or trial.iti is called next
<trial flanker_onlytarget>
/ontrialbegin = [values.response == ""]
/ontrialbegin = [values.trialtype = list.trialtype_practice1.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selecttarget = 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selecttarget = 2}]
/ontrialbegin = [if (values.trialtype == 5) {values.selecttarget = 3}]
/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]
/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]


/stimulusframes = [1 = flanker1, flanker2, target]
/monkeyresponse = (38, 51, 52)
/isvalidresponse = [{(trial.flanker_onlytarget.response == values.responsekey_targetright) || (trial.flanker_onlytarget.response == values.responsekey_targetup)} ||
(trial.flanker_onlytarget.response == values.responsekey_targetleft) ]
/iscorrectresponse = [{(values.targetdirection == "targetright" && trial.flanker_onlytarget.response == values.responsekey_targetright) ||
(values.targetdirection == "targetleft" && trial.flanker_onlytarget.response == values.responsekey_targetleft)} ||
(values.targetdirection == "targetup" && trial.flanker_onlytarget.response == values.responsekey_targetup)]

/beginresponsetime = 0
/responseinterrupt = immediate

/ontrialend = [if (trial.flanker_onlytarget.error)
{values.response = "accuracy error"; values.selecterrorfeedback = 3} else values.response = "correct valid"]
/ontrialend = [if (trial.flanker_onlytarget.latency < values.anticipatoryresponselatency) {values.response = "anticipatory"; values.selecterrorfeedback = 1}]
/ontrialend = [if (trial.flanker_onlytarget.latency >= values.max_trialduration) {values.response = "too slow"; values.selecterrorfeedback = 2}]

/timeout = values.max_trialduration
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
</trial>

Note:
* trial used for practice2 and the actual test => targets AND flankers are presented
* selects the next target based on list.trialtype_practice2 or list.trialtype
* based on response either trial.errorfeedback or trial.iti is called next
!!Note: to circumvent trial.errorfeedback => change
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
TO
/branch = [trial.iti]

<trial flanker>
/ontrialbegin = [values.response == ""]
/ontrialbegin = [if (script.currentblock == "practice2") values.trialtype = list.trialtype_practice2.nextvalue else values.trialtype = list.trialtype.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selectflanker = 1; values.selecttarget = 1; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 2; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 3; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selectflanker = 2; values.selecttarget = 2; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 1; values.selecttarget = 2; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 3; values.selecttarget = 2; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 5) {values.selectflanker = 3; values.selecttarget = 3; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 1; values.selecttarget = 3; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 2; values.selecttarget = 3; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]
/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]
/ontrialbegin = [if (values.trialtype == 1 || values.trialtype == 3|| values.trialtype == 5 ) {values.congruence = "congruent"}]
/ontrialbegin = [if (values.trialtype == 2 || values.trialtype == 4|| values.trialtype == 6) {values.congruence = "incongruent"}]

/stimulusframes = [1 = flanker1, flanker2, target]
/monkeyresponse = (38, 51, 52)
/isvalidresponse = [trial.flanker_onlytarget.response == values.responsekey_targetright || trial.flanker_onlytarget.response == values.responsekey_targetup|| trial.flanker_onlytarget.response == values.responsekey_targetleft ]
/iscorrectresponse = [(values.targetdirection == "targetright" && trial.flanker_onlytarget.response == values.responsekey_targetright) ||
(values.targetdirection == "targetleft" && trial.flanker_onlytarget.response == values.responsekey_targetleft)||
(values.targetdirection == "targetup" && trial.flanker_onlytarget.response == values.responsekey_targetup)]

/ontrialend = [if (trial.flanker.error)
{values.response = "accuracy error"; values.selecterrorfeedback = 3} else values.response = "correct valid"]
/ontrialend = [if (trial.flanker.latency < values.anticipatoryresponselatency) {values.response = "anticipatory"; values.selecterrorfeedback = 1}]
/ontrialend = [if (trial.flanker.latency >= values.max_trialduration) {values.response = "too slow"; values.selecterrorfeedback = 2}]

/ontrialend = [if (values.response == "correct valid" && values.congruence == "congruent")
{values.count_correctcongruent += 1; values.sumrt_correctcongruent += trial.flanker.latency}]
/ontrialend = [if (values.response == "correct valid" && values.congruence == "incongruent")
{values.count_correctincongruent += 1; values.sumrt_correctincongruent += trial.flanker.latency}]

/timeout = values.max_trialduration
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
</trial>

Notes:
* presents errorfeedback in text and plays a soundfile
* duration determined by values.errorfeedbackduration (editable)
* calls trial.iti

<trial errorfeedback>
/stimulusframes = [1 = errorfeedback]
/trialduration = values.errorfeedbackduration
/recorddata = false
/branch = [trial.iti]
</trial>

Notes:
* adds the intertrial pause to the trial sequence
* calls trial.rest if the number of trials before a resttrial have been reached
* otherwise starts the cycle over again
<trial iti>
/trialduration = values.iti
/ontrialend = [values.count_itis += 1]
/recorddata = false
/branch = [if (mod(values.count_itis, values.resttrial) == 0) trial.rest]
/branch = [if (script.currentblock == "practice1") trial.flanker_onlytarget else trial.flanker]
</trial>

Notes:
* adds a rest trial
* starts the cycle over again
<trial rest>
/stimulusframes = [1 = rest, restclock]
/trialduration = clock.restclock.timeout
/recorddata = false
/branch = [if (script.currentblock == "practice1") trial.flanker_onlytarget else trial.flanker]
</trial>

*******************************************************************************************************************
*******************************************************************************************************************
BLOCKS
*******************************************************************************************************************
*******************************************************************************************************************

Notes:
* runs as many trials as specified under values.numberofpracticetrials (editable value)
* runs only trials that present a target (no flankers)
<block practice1>
/preinstructions = (practice1)
/onblockbegin = [values.count_itis = 0]
/stop = [values.count_itis == values.numberofpracticetrials]
/trials = [1 = flanker_onlytarget]
</block>

Notes:
* runs as many trials as specified under values.numberofpracticetrials (editable value)
* runs the target AND flankers (same as block.flankertest)
<block practice2>
/preinstructions = (practice2)
/onblockbegin = [values.count_itis = 0]
/stop = [values.count_itis == values.numberofpracticetrials]
/trials = [1 = flanker]
</block>

Notes:
* runs as many trials as specified under values.numberoftrials (editable value)
* resets summary variables
* runs the target AND flankers
<block flankertest>
/preinstructions = (testintro)
/onblockbegin = [values.count_itis = 0]
/onblockbegin = [values.count_congruent = 0; values.count_correctincongruent = 0]
/onblockbegin = [values.count_correctcongruent = 0; values.count_correctincongruent = 0]
/onblockbegin = [values.sumrt_correctcongruent = 0; values.sumrt_correctincongruent = 0]
/stop = [values.count_itis == values.numberoftrials]
/trials = [1 = flanker]
</block>

*******************************************************************************************************************
*******************************************************************************************************************
EXPERIMENT
*******************************************************************************************************************
*******************************************************************************************************************
Notes: experiment runs
1. Practice block (20 trials, only center fish)
2. Practice block (20 trials, center and flanker fish)
3. Test block (120 trials, center and flanker fish)

<expt >
/preinstructions = (intro)
/postinstructions = (end)
/blocks = [1 = practice1; 2 = practice2; 3 = flankertest]
</expt>

*******************************************************************************************************************
*******************************************************************************************************************
MONKEY: sets the parameters for monkey responses
*******************************************************************************************************************
*******************************************************************************************************************
<monkey>
/ latencydistribution = normal(350, 200)
</monkey>

*******************************************************************************************************************
End of File
*******************************************************************************************************************
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: 13K, Visits: 104K
Please be so kind and *attach* the script AND the external files it needs to run (images, etc.). Put them all in a ZIP archive and click +Insert -> Add File to upload the attachment.

Please also be so kind and take the time to *describe* and highlight the specific changes you made. Otherwise I would have to first completely reverse-engineer your script, making the possibility of a timely response unlikely.

Thanks!

Tobiii
Tobiii
Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 24
Hi Dave,

Sorry for the inconvenience. The changes I made are highlighted in yellow. What I did basically was the change the quote in such a way that it accommodates three different stimuli rather than two. I introduced a new key for the third stimuli, included more trail types and more options to ensure the validation of the response.

Thanks!
Attachments
flanker.zip (222 views, 90.00 KB)
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: 13K, Visits: 104K
In the meantime, here's a bunch of stuff that doesn't make sense:

<trial flanker>
/ontrialbegin = [values.response == ""]

/ontrialbegin = [if (script.currentblock == "practice2") values.trialtype = list.trialtype_practice2.nextvalue else values.trialtype = list.trialtype.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selectflanker = 1; values.selecttarget = 1; values.count_congruent += 1}]

/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 2; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 3; values.selecttarget = 1; values.count_incongruent += 1}]
#1: ^ontrialbegin attributes are executed in the order given. You have two statements that trigger on the same condition. If values.trialtype equals 2 the 1st statement will be executed, i.e. values.selectflanker will be set to 2, etc.
Then the 2nd statement will be executed, i.e., after previously having been set to 2 (in the 1st statement), values.selectflanker will now be set to 3, etc. As a consequence, only the 2nd statement has any effect, the 1st statement might as well not exist at all.


/ontrialbegin = [if (values.trialtype == 3) {values.selectflanker = 2; values.selecttarget = 2; values.count_congruent += 1}]

/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 1; values.selecttarget = 2; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 3; values.selecttarget = 2; values.count_incongruent += 1}]
#2: ^same issue as detailed in #1 above.

/ontrialbegin = [if (values.trialtype == 5) {values.selectflanker = 3; values.selecttarget = 3; values.count_congruent += 1}]

/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 1; values.selecttarget = 3; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 2; values.selecttarget = 3; values.count_incongruent += 1}]
#3: ^same issue as detailed in #1 above.

/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]

/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]
#4: ^&& is a logical AND. *Both* statements in the condition have to be true for the entire condition to be true. This can never be the case. values.trialtype cannot be equal to 3 and equal to 4 at the same time. As a consequence values.targetdirection will *never* be set to "targetleft". What you want here is a logical OR, i.e. the || operator.

/ontrialbegin = [if (values.trialtype == 1 || values.trialtype == 3|| values.trialtype == 5 ) {values.congruence = "congruent"}]
/ontrialbegin = [if (values.trialtype == 2 || values.trialtype == 4|| values.trialtype == 6) {values.congruence = "incongruent"}]
...
</trial>

Identical / similar problems exist in other parts of your script, for example in

<trial flanker_onlytarget>
/ontrialbegin = [values.response == ""]
/ontrialbegin = [values.trialtype = list.trialtype_practice1.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selecttarget = 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selecttarget = 2}]
/ontrialbegin = [if (values.trialtype == 5) {values.selecttarget = 3}]
/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]
/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]
^see issue #4
...
</trial>

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: 13K, Visits: 104K
If there actually are any (yellow) highlights in any of the Word documents you attached, my word processor isn't showing them. However, do see my previous reply regarding various logic errors in your code. Start by reviewing your code accordingly and fixing those issues.

Tobiii
Tobiii
Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)Respected Member (421 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 24
Hi Dave, 
Tthanks for the quick reply. In  my file, the edited parts were in yellow but in the event you can't see it, I have reposted my code here and the edited portions are in bold. This is my first time using this software so please suggest how the correct code should be.

Thanks!


 *******************************************************************************************************************
*******************************************************************************************************************
CHILD FLANKER TEST
*******************************************************************************************************************
*******************************************************************************************************************
Script Info

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 02-25-2014

last updated: 02-26-2014 by K.Borchert for Millisecond Software LLC

Copyright © 02-26-2014 Millisecond Software
*******************************************************************************************************************
*******************************************************************************************************************
BACKGROUND INFO
*******************************************************************************************************************
*******************************************************************************************************************
*SCRIPT PURPOSE*

This script implements a basic Flanker Test for children as described in:

Christ, S.E., Kester, L.E., Bodner, K.E. & Miles, J.H. (2011). Evidence for Selective Inhibitory Impairment in Individuals 
With Autism Spectrum Disorder. Neuropsychology, 25, 690–701.


*TASK*
Participants are presented 5 fish in one row and are instructed to pay attention to the center fish (target).
If the center fish looks to the right, participants are instructed to press a specific response key.
If the center fish looks to the left, participants are instructed to press a different response key.
The fish flanking the middle fish (the flankers) can either look in the same (compatible) or the 
opposite direction (incompatible) than the target/center fish (Note: the flanker fish always look in the same direction).


*SCRIPT SPECIFICS*

(1) EDITABLE CODE:
Check under EDITABLE CODE for (relatively) easily editable values, stimuli, instructions etc. 
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to 
further customize your experiment.

If you have any questions, please don't hesitate to contact Millisecond Software.

(2) EXPERIMENTAL SET-UP
2 congruence (congruent vs incongruent) x 2 target directions (right vs left) tested within participants

1. Practice Block: 20 trials with only targets (10 left, 10 right, randomly sampled)
2. Practice Block: 20 trials with targets and flankers (5 congruent_left, 5 congruent_right, 5 incongruent_right, 5 incongruent_left,
randomly sampled)
3. Test Block: 120 trials with targets and flankers (all 4 conditions equally often, randomly sampled)
=> number of trials can be edited under EDITABLE CODE -> Editable Values

Trial Sequence:
1. trial.flanker: trialduration max. 3000ms (default, editable) 
-> trial terminates immediately after a given response or after max trialduration.

!!Note: to adjust the size of the 5 fish on your monitor, go to EDITABLE CODE -> Editable Values and edit
values.pictureheight and/or values.flankerdistance

2. (trial.errorfeedback): if errors occurred; error trialduration editable
Errors:
a) Anticipatory response: responses faster than values.anticipatoryresponselatency (default: 200ms, editable value)
b) Too slow: no response occuring before values.max_trialduration (default: 3000ms = max trialduration of trial.flanker, editable value)
c) Wrong Response: incorrect response key was pressed

Error feedback is presented in a visual (text that specifies the specific error) and auditory form (sound file).

3. trial.iti: trialduration 1500ms (default, editable)
4. (trial.rest): if number of trials indicate that a rest trial should be presented (default: after 40 trials, editable)

(3) STIMULI
Fish stimuli are used from the ChildANT.iqx script (the fish were originally downloaded from:
http://www.sacklerinstitute.org/cornell/assays_and_tools/)

(4) INSTRUCTIONS
Instructions are not original. They can easily be edited under EDITABLE CODE -> Editable Instructions

(5) DATA
Check under DATA for data file information - customize if necessary

*******************************************************************************************************************
*******************************************************************************************************************
EDITABLE CODE: The code in this section can be easily altered (look for additional instructions were indicated)
*******************************************************************************************************************
*******************************************************************************************************************

***************************************************************************************
*********************************************
Editable Values
*********************************************
***************************************************************************************

Responsekeys:
/responsekey_targethappy:scancode of the response key for happy face (default: 52)
/responsekeytargethappy_label:description of the response key for happy face
/responsekey_targetsad:  scancode of the response key for sad face (default: 51)
/responsekeytargetsad_label:description of the response key sad face
/responsekey_targetneutral:scancode of the response key for neutral face (default: 50)
/responsekeytargetneutral_label:description of the response key for neutral face

Fish presentation:
/pictureheight:determines the size/height in screen height % of the individual fish pictures (default: 10%)
/flankerdistance:determines the distance in screen width % between flankers (default: 10%)
Note: change these parameters to optimize the fish presentation on your screen

/errorfeedbackheight:determines the height of the feedback text in screen height (default: 5%)

Trialnumbers:
/numberofpracticetrials:determines the number of practice trials in each practice blocks (default: 20)
/numberoftrials:determines the number of test trials (default: 160)
Note: list.trialtype controls the distribution of congruent/incongruent trials
by default, the same number of congruent right, incongruent right, congruent left, incongruent left
trials are run.
/resttrial:determines the number of trials after which a rest trial is presented

Trialdurations:
/max_trialduration:the maximum trial duration of the flanker presentation (default: 3000ms)
/iti:the duration of the intertrial interval - time between response and next presentation
OR time between offset of errorfeedback and next presentation (default: 1500ms)
/errorfeedbackduration:duration of error feedback (default: 1000ms)
/restduration:duration of rest trial (default: 60000ms)

/anticipatoryresponselatency:all response latencies lower than this value will be categorized as "anticipatory responses" (default: 200ms)


<values>
/responsekey_targetright = 52
/responsekeytargetright_label = ">"
/responsekey_targetleft = 51
/responsekeytargetleft_label = "<"
/responsekey_targetup = 38
/responsekeytargetup_label = "l"


/pictureheight = 10%
/flankerdistance = 10%

/errorfeedbackheight = 5%

/numberofpracticetrials = 20
/numberoftrials = 120
/resttrial = 40

/max_trialduration = 3000
/iti = 1500
/errorfeedbackduration = 1000
/restduration = 60000

/anticipatoryresponselatency = 200
</values>


***************************************************************************************
*********************************************
Editable Stimuli
*********************************************
***************************************************************************************
<item face>
/1 = "Untitled.png"
/2 = "Untitled2.png"
/3 = "Untitled3.png"

</item>

<item errorfeedback>
/1 = "Early Response"
/2 = "Too slow"
/3 = "Wrong Response"
</item>


<item restinstructions>
/1 = "Take a rest"
</item>

***************************************************************************************
*********************************************
Editable Instructions
*********************************************
***************************************************************************************
<instruct>
/windowsize = (90%, 90%)
/ fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/ txcolor = (black)
/ finishlabel = "Press <Spacebar> to continue"
/nextkey = (57)
/nextlabel = "Press <Spacebar> to continue"
/prevkey = (28)
/prevlabel = "Press <Enter> to go back"
</instruct>

<page intro>
Welcome!
^^^In this experiment you will be presented 3 faces in a row. You will be asked to pay attention to whether the center face is happy, sad or neutral.
^^^^^Press <SPACEBAR> to continue to some practice.
</page>

<page practice1>
This is a practice session.
^^In this practice session you will be presented with 1 face in the center of your computer screen.
^Pay attention to whether this face is happy, sad or neutral.
^^^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.

^***************************************************************************************
^^It's important that you press the button as fast as you can without making many errors.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start.
</page>

<page practice2>
This is a second practice session.
^^In this practice session you will be presented with 3 faces in a row. 
^^Just like during the first practice session pay attention only to the MIDDLE FACE in the center of the screen and
try to ignore the face to either side of the center face.
^^^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.
^***************************************************************************************
^^The face to either side of the center face might look in the same or different from the center face. 
Try to ignore them when doing this task.
^^Just like before it's important that you press the button as fast as you can without making many errors.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start the next practice sessions.
</page>


<page testintro>
Practice is over now and the actual task is about to start.
^^The actual task is exactly the same as you have just practiced: 
^You will be presented with 3 faces in a row. Pay attention only to the MIDDLE FACE in the center of the screen and
try to ignore the face to either side of the center face.
^***************************************************************************************
^If the face looks happy: Press the '<%values.responsekeytargetright_label%>' - key on your keyboard.
^If the face looks sad: Press the '<%values.responsekeytargetleft_label%>' - key on your keyboard.
^If the face looks neutral: Press the '<%values.responsekeytargetup_label%>' - key on your keyboard.
^***************************************************************************************
^^The face to either side of the center face might look in the same or different from the center face. 
Try to ignore them when doing this task.
^^Just like before it's important that you press the button as fast as you can without making many errors.
^^The actual task is going to be longer than the practice session. You will be given a couple of breaks.
^^^Place the index fingers of your left and right hand on the response keys.
^^^Press <SPACEBAR> to start.
</page>

<page end>
You have reached the end of the study. Thank you for your participation!
</page>


*******************************************************************************************************************
*******************************************************************************************************************
DATA: this section contains data file information
*******************************************************************************************************************
*******************************************************************************************************************

********************
raw data
********************
date, time, subject:date and time script was run with the current subjectnumber 
blockcode, blocknum:the name and number of the current block
trialcode, trialnum: the name and number of the currently recorded trial
(Note: not all trials that are run might record data) 
/trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
/congruence:stores the congruence of the target and flankers (congruent vs incongruent)
/targetdirection:stores the direction of the target fish (targethappy vs targetsad vs targetneutral)
stimulusitem:the presented stimuli in order of trial presentation
response:the participant's response (scancode)
/response:stores the response category depending on latency and response key used ("anticipatory", "valid", "too slow", "wrong response")
correct:the correctness of the response
latency: the response latency


<data>
/file = "ChildFlanker_rawdata.iqdat"
/columns = [date, time, subject, group, blockcode, blocknum, trialcode, trialnum, values.trialtype, values.congruence, 
values.targetdirection,
stimulusitem, stimulusitem, stimulusitem, 
response, values.response, correct, latency]
/separatefiles = true
</data>


********************
summary data
********************
/percenterrors_c: percent errors in congruent trials (test only)
/percenterrors_i:percent errors in incongruent trials (test only)
/meanRT_cc:mean latency of correct responses in congruent trials
/meanRT_ci:mean latency of correct responses in incongruent trials

<summarydata >
/file = "ChildFlanker_summary.iqdat"
/columns = [script.startdate, script.starttime, script.subjectid, script.groupid, 
expressions.percenterrors_c, expressions.percenterrors_i,
expressions.meanrt_cc, expressions.meanrt_ci]
</summarydata>


*******************************************************************************************************************
*******************************************************************************************************************
REMAINING CODE: Customize after careful consideration only
*******************************************************************************************************************
*******************************************************************************************************************

*******************************************************************************************************************
*******************************************************************************************************************
DEFAULTS:
*******************************************************************************************************************
*******************************************************************************************************************
requires Inquisit 4.0.5.0

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

*******************************************************************************************************************
*******************************************************************************************************************
VALUES: automatically updated
*******************************************************************************************************************
*******************************************************************************************************************
/selecttarget:determines which face is selected for the target (happy vs sad vs neutral)
/selectflanker:determines which faces are selected for the flankers (happy vs sad vs neutral)
/selecterrorfeedback:determines the error feedback text
/trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
/count_itis:counts the number of intertrial intervals (used to stop each block)

/targetdirection:stores the direction of the target fish (targethappy vs targetsad vs targetneutral)
/congruence:stores the congruence of the target and flankers (congruent vs incongruent)
/response:stores the response category ("anticipatory", "valid", "too slow", "wrong response")
Note: correct and incorrec tresponses that are "anticipatory" are both categorized as "anticipatory"

<values>
/selecttarget = 1
/selectflanker = 1
/selecterrorfeedback = 1
/trialtype = 0
/count_itis = 0

/targetdirection = ""
/congruence = ""
/response = ""
</values>

Summary Variables:
/count_congruent:counts all congruent trials (test only)
/count_incongruent:counts all incongruent trials (test only)

/count_correctcongruent:counts the number of congruent trials with a correct response (test only)
/count_correctincongruent:counts the number of incongruent trials with a correct response (test only)
/sumrt_correctcongruent:sums up the latencies of all correct congruent trials (test only)
/sumrt_correctincongruent:sums up the latencies of all correct incongruent trials (test only)

<values>
/count_congruent = 0
/count_incongruent = 0
/count_correctcongruent = 0
/count_correctincongruent = 0
/sumrt_correctcongruent = 0
/sumrt_correctincongruent = 0
</values>

*******************************************************************************************************************
*******************************************************************************************************************
EXPRESSIONS
*******************************************************************************************************************
*******************************************************************************************************************
/percenterrors_c: percent errors in congruent trials (test only)
/percenterrors_i:percent errors in incongruent trials (test only)
/meanRT_cc:mean latency of correct responses in congruent trials
/meanRT_ci:mean latency of correct responses in incongruent trials

<expressions>
/percenterrors_c = (1 - (values.count_correctcongruent/values.count_congruent)) * 100
/percenterrors_i = (1 - (values.count_correctincongruent/values.count_incongruent)) * 100
/meanRT_cc = values.sumrt_correctcongruent/values.count_correctcongruent
/meanRT_ci = values.sumrt_correctincongruent/values.count_correctincongruent
</expressions>

*******************************************************************************************************************
*******************************************************************************************************************
STIMULI
*******************************************************************************************************************
*******************************************************************************************************************

<picture flanker1>
/items = face
/select = values.selectflanker
/position = (picture.target.hposition - 2*values.flankerdistance, 50%)
/size = (100%, values.pictureheight)
</picture>

*the center face = target
<picture target>
/items = face
/select = values.selecttarget
/position = (50%, 50%)
/size = (100%, values.pictureheight)
</picture>

<picture flanker2>
/items = face
/select = values.selectflanker
/position = (picture.target.hposition + 2*values.flankerdistance, 50%)
/size = (100%, values.pictureheight)
</picture>





***********************
Stimuli for Errorfeedback
***********************
<text errorfeedback>
/items = errorfeedback
/select = values.selecterrorfeedback
/position = (50%, 50%)
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
/ txcolor = (red)
</text>



***********************
Stimuli for Resttrial
***********************
<text rest>
/items = restinstructions
/select = 1
/position = (50%, 30%)
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
/ txcolor = (black)
</text>

<clock restclock>
/ mode = timer
/ resetrate = trial
/ txcolor = yellow
/ txbgcolor = black
/ timeout = values.restduration
/ position = (50%, 50%)
/ format = "mm:ss"
/ fontstyle = ("Arial", values.errorfeedbackheight, false, false, false, false, 5, 1)
</clock>4

*******************************************************************************************************************
*******************************************************************************************************************
LISTS
*******************************************************************************************************************
*******************************************************************************************************************
trialtype:1 = congruent, happy face
2 = incongruent, happy face
3 = congruent, sad face
4 = incongruent, sad face
           5 = congruent, neutral face
6 = incongruent, neutral face
all lists sample a trialtype randomly without replacement for as many trials as specified by
values.numberoftrials/values.numberofpracticetrials. By default all trialtypes
are sampled equally often.

<list trialtype_practice1>
/items = (1, 3, 5)
/replace = false
/poolsize = values.numberofpracticetrials
/resetinterval = 1
</list>

<list trialtype_practice2>
/items = (1, 2, 3, 4, 5, 6)
/replace = false
/poolsize = values.numberofpracticetrials
/resetinterval = 1
</list>

<list trialtype>
/items = (1, 2, 3, 4, 5, 6)
/replace = false
/poolsize = values.numberoftrials
/resetinterval = 1
</list>

*******************************************************************************************************************
*******************************************************************************************************************
TRIALS
*******************************************************************************************************************
*******************************************************************************************************************

Note:
* trial used for practice1 => only targets are presented (no flankers)
* selects the next target based on list.trialtype_practice1
* based on response either trial.errorfeedback or trial.iti is called next 
<trial flanker_onlytarget>
/ontrialbegin = [values.response == ""]
/ontrialbegin = [values.trialtype = list.trialtype_practice1.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selecttarget = 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selecttarget = 2}]
/ontrialbegin = [if (values.trialtype == 5) {values.selecttarget = 3}]
/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]
/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]


/stimulusframes = [1 = flanker1, flanker2, target]
/monkeyresponse = (38, 51, 52)
/isvalidresponse = [{(trial.flanker_onlytarget.response == values.responsekey_targetright) || (trial.flanker_onlytarget.response == values.responsekey_targetup)} || 
(trial.flanker_onlytarget.response == values.responsekey_targetleft) ]
/iscorrectresponse = [{(values.targetdirection == "targetright" && trial.flanker_onlytarget.response == values.responsekey_targetright) ||
(values.targetdirection == "targetleft" && trial.flanker_onlytarget.response == values.responsekey_targetleft)} ||
(values.targetdirection == "targetup" && trial.flanker_onlytarget.response == values.responsekey_targetup)]


/beginresponsetime = 0
/responseinterrupt = immediate

/ontrialend = [if (trial.flanker_onlytarget.error) 
{values.response = "accuracy error"; values.selecterrorfeedback = 3} else values.response = "correct valid"]
/ontrialend = [if (trial.flanker_onlytarget.latency < values.anticipatoryresponselatency) {values.response = "anticipatory"; values.selecterrorfeedback = 1}]
/ontrialend = [if (trial.flanker_onlytarget.latency >= values.max_trialduration) {values.response = "too slow"; values.selecterrorfeedback = 2}]

/timeout = values.max_trialduration
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
</trial>

Note:
* trial used for practice2 and the actual test => targets AND flankers are presented
* selects the next target based on list.trialtype_practice2 or list.trialtype
* based on response either trial.errorfeedback or trial.iti is called next 
!!Note: to circumvent trial.errorfeedback => change
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
TO
/branch = [trial.iti]

<trial flanker>
/ontrialbegin = [values.response == ""]
/ontrialbegin = [if (script.currentblock == "practice2") values.trialtype = list.trialtype_practice2.nextvalue else values.trialtype = list.trialtype.nextvalue]
/ontrialbegin = [if (values.trialtype == 1) {values.selectflanker = 1; values.selecttarget = 1; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 2; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 3; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selectflanker = 2; values.selecttarget = 2; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 1; values.selecttarget = 2; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 4) {values.selectflanker = 3; values.selecttarget = 2; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 5) {values.selectflanker = 3; values.selecttarget = 3; values.count_congruent += 1}]
/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 1; values.selecttarget = 3; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 6) {values.selectflanker = 2; values.selecttarget = 3; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype < 3) {values.targetdirection = "targetright"}]
/ontrialbegin = [if (values.trialtype > 4) {values.targetdirection = "targetup"}]
/ontrialbegin = [if (values.trialtype == 3 && values.trialtype == 4) {values.targetdirection = "targetleft"}]
/ontrialbegin = [if (values.trialtype == 1 || values.trialtype == 3|| values.trialtype == 5 ) {values.congruence = "congruent"}]
/ontrialbegin = [if (values.trialtype == 2 || values.trialtype == 4|| values.trialtype == 6) {values.congruence = "incongruent"}]

/stimulusframes = [1 = flanker1, flanker2, target]
/monkeyresponse = (38, 51, 52)
/isvalidresponse = [trial.flanker_onlytarget.response == values.responsekey_targetright || trial.flanker_onlytarget.response == values.responsekey_targetup|| trial.flanker_onlytarget.response == values.responsekey_targetleft ]
/iscorrectresponse = [(values.targetdirection == "targetright" && trial.flanker_onlytarget.response == values.responsekey_targetright) || 
(values.targetdirection == "targetleft" && trial.flanker_onlytarget.response == values.responsekey_targetleft)||
(values.targetdirection == "targetup" && trial.flanker_onlytarget.response == values.responsekey_targetup)]


/ontrialend = [if (trial.flanker.error) 
{values.response = "accuracy error"; values.selecterrorfeedback = 3} else values.response = "correct valid"]
/ontrialend = [if (trial.flanker.latency < values.anticipatoryresponselatency) {values.response = "anticipatory"; values.selecterrorfeedback = 1}]
/ontrialend = [if (trial.flanker.latency >= values.max_trialduration) {values.response = "too slow"; values.selecterrorfeedback = 2}]

/ontrialend = [if (values.response == "correct valid" && values.congruence == "congruent") 
{values.count_correctcongruent += 1; values.sumrt_correctcongruent += trial.flanker.latency}]
/ontrialend = [if (values.response == "correct valid" && values.congruence == "incongruent") 
{values.count_correctincongruent += 1; values.sumrt_correctincongruent += trial.flanker.latency}]

/timeout = values.max_trialduration
/branch = [if (values.response != "correct valid") trial.errorfeedback else trial.iti]
</trial>

Notes:
* presents errorfeedback in text and plays a soundfile
* duration determined by values.errorfeedbackduration (editable)
* calls trial.iti

<trial errorfeedback>
/stimulusframes = [1 = errorfeedback]
/trialduration = values.errorfeedbackduration
/recorddata = false
/branch = [trial.iti]
</trial>

Notes:
* adds the intertrial pause to the trial sequence
* calls trial.rest if the number of trials before a resttrial have been reached
* otherwise starts the cycle over again
<trial iti>
/trialduration = values.iti
/ontrialend = [values.count_itis += 1]
/recorddata = false
/branch = [if (mod(values.count_itis, values.resttrial) == 0) trial.rest]
/branch = [if (script.currentblock == "practice1") trial.flanker_onlytarget else trial.flanker]
</trial>

Notes:
* adds a rest trial
* starts the cycle over again
<trial rest>
/stimulusframes = [1 = rest, restclock]
/trialduration = clock.restclock.timeout
/recorddata = false
/branch = [if (script.currentblock == "practice1") trial.flanker_onlytarget else trial.flanker]
</trial>

*******************************************************************************************************************
*******************************************************************************************************************
BLOCKS
*******************************************************************************************************************
*******************************************************************************************************************

Notes:
* runs as many trials as specified under values.numberofpracticetrials (editable value)
* runs only trials that present a target (no flankers)
<block practice1>
/preinstructions = (practice1)
/onblockbegin = [values.count_itis = 0]
/stop = [values.count_itis == values.numberofpracticetrials]
/trials = [1 = flanker_onlytarget]
</block>

Notes:
* runs as many trials as specified under values.numberofpracticetrials (editable value)
* runs the target AND flankers (same as block.flankertest)
<block practice2>
/preinstructions = (practice2)
/onblockbegin = [values.count_itis = 0]
/stop = [values.count_itis == values.numberofpracticetrials]
/trials = [1 = flanker]
</block>

Notes:
* runs as many trials as specified under values.numberoftrials (editable value)
* resets summary variables
* runs the target AND flankers
<block flankertest>
/preinstructions = (testintro)
/onblockbegin = [values.count_itis = 0]
/onblockbegin = [values.count_congruent = 0; values.count_correctincongruent = 0]
/onblockbegin = [values.count_correctcongruent = 0; values.count_correctincongruent = 0]
/onblockbegin = [values.sumrt_correctcongruent = 0; values.sumrt_correctincongruent = 0]
/stop = [values.count_itis == values.numberoftrials]
/trials = [1 = flanker]
</block>

*******************************************************************************************************************
*******************************************************************************************************************
EXPERIMENT
*******************************************************************************************************************
*******************************************************************************************************************
Notes: experiment runs
1. Practice block (20 trials, only center fish)
2. Practice block (20 trials, center and flanker fish)
3. Test block (120 trials, center and flanker fish)

<expt >
/preinstructions = (intro)
/postinstructions = (end)
/blocks = [1 = practice1; 2 = practice2; 3 = flankertest]
</expt>

*******************************************************************************************************************
*******************************************************************************************************************
MONKEY: sets the parameters for monkey responses
*******************************************************************************************************************
*******************************************************************************************************************
<monkey>
/ latencydistribution = normal(350, 200)
</monkey>

*******************************************************************************************************************
End of File
******************************************************************************************************************
_stats"�[w{�ӭ

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: 13K, Visits: 104K
I think I've already pointed out the vast majority of issues.

If you want to fix #1 (see my previous reply), you need additional values in the trialtype list, i.e.

/ontrialbegin = [if (values.trialtype == 2) {values.selectflanker = 2; values.selecttarget = 1; values.count_incongruent += 1}]
/ontrialbegin = [if (values.trialtype == 3) {values.selectflanker = 3; values.selecttarget = 1; values.count_incongruent += 1}]
and so forth
#1: ^ontrialbegin attributes are executed in the order given. You have two statements that trigger on the same condition. If values.trialtype equals 2 the 1st statement will be executed, i.e. values.selectflanker will be set to 2, etc.
Then the 2nd statement will be executed, i.e., after previously having been set to 2 (in the 1st statement), values.selectflanker will now be set to 3, etc. As a consequence, only the 2nd statement has any effect, the 1st statement might as well not exist at all.

Additionally, the /isvalidresponse attribute in your <trial flanker_onlytarget> seems off. Note the odd position of the curly braces, which IMO should be there at all.

/isvalidresponse= [{(trial.flanker_onlytarget.response ==values.responsekey_targetright) || (trial.flanker_onlytarget.response== values.responsekey_targetup)}|| (trial.flanker_onlytarget.response== values.responsekey_targetleft) ]


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search