Random presentation of coloured letters


Author
Message
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Hi All,

I am new to Inquisit and in the process of programming an illusory conjunction task. The paradigm involves the random presentation of three coloured letters flanked by two digits (see image: ). The letters are sampled from a target-population (e.g., X or N) and a distractor population (e.g., HSTO). On a given trial, the letters should be distinct in colour and letter. I am struggling to implement this characteristic in Inquisit and would greatly appreciate your help. 

Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours, I have switched to images and defined them as follows:

<item targets>
/1 = "Stimuli\nblue.png"
/2 = "Stimuli\ngreen.png"
...
</item>

<item distractors>
/1 = "Stimuli\oblue.png"
/2 = "Stimuli\ogreen.png"
...
</item>

<list xpos>
/items = (35%,50%,65%)
/ selectionrate = always
/ resetinterval = 0
</list>

<list target>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = trial
/ resetinterval = 0
</list>


Using this code, the pictures are sampled via values determined at the start of each trial (with ontrialstart), which looks like the following:

<picture target>
/ items = letters
/ select = list.target.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr1>
/ items = distractors
/ select = list.distractor1.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr2>
/ items = distractors
/ select = list.distractor2.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>


The following if-functions are thought to limit the possible distractor space depending on the characteristics of the already selected stimuli. In theory that is, as the if-functions appear not to work as intended. Trials frequently feature stimuli with the same letter or colour. I hope the above code-chunks are sufficient, if not, please see the attached file with the entire script. Thanks in advance for your help!

All the best,
Lukas


Attachments
II-Task.iqx (155 views, 16.00 KB)
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
lukasg - 1/24/2022
Hi All,

I am new to Inquisit and in the process of programming an illusory conjunction task. The paradigm involves the random presentation of three coloured letters flanked by two digits (see image: ). The letters are sampled from a target-population (e.g., X or N) and a distractor population (e.g., HSTO). On a given trial, the letters should be distinct in colour and letter. I am struggling to implement this characteristic in Inquisit and would greatly appreciate your help. 

Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours, I have switched to images and defined them as follows:

<item targets>
/1 = "Stimuli\nblue.png"
/2 = "Stimuli\ngreen.png"
...
</item>

<item distractors>
/1 = "Stimuli\oblue.png"
/2 = "Stimuli\ogreen.png"
...
</item>

<list xpos>
/items = (35%,50%,65%)
/ selectionrate = always
/ resetinterval = 0
</list>

<list target>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = trial
/ resetinterval = 0
</list>


Using this code, the pictures are sampled via values determined at the start of each trial (with ontrialstart), which looks like the following:

<picture target>
/ items = letters
/ select = list.target.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr1>
/ items = distractors
/ select = list.distractor1.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr2>
/ items = distractors
/ select = list.distractor2.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>


The following if-functions are thought to limit the possible distractor space depending on the characteristics of the already selected stimuli. In theory that is, as the if-functions appear not to work as intended. Trials frequently feature stimuli with the same letter or colour. I hope the above code-chunks are sufficient, if not, please see the attached file with the entire script. Thanks in advance for your help!

All the best,
Lukas


This is trial-code, intended to update the values to sample the picture stimuli:

<trial trial200>
/ ontrialbegin = [
    values.selectTarget = list.target.nextvalue;
    values.currentTarget = values.selectTarget;
    
    if(values.selectTarget.currentvalue == 1 || values.selectTarget.currentvalue == 7){
        values.targetColor = "blue"
    } elese if (values.selectTarget.currentvalue == 3 || values.selectTarget.currentvalue == 9){
        values.targetColor = "green"
    } else if (values.selectTarget.currentvalue == 6 || values.selectTarget.currentvalue == 12){
        values.targetColor = "red"
    }
    
    list.xpos.reset();
    picture.target.hposition = list.xpos.nextvalue;
    picture.distr1.hposition = list.xpos.nextvalue;
    picture.distr2.hposition = list.xpos.nextvalue;
    
    //TARGET - SELECTION OF 1st DISTR
    if(picture.target.currentvalue == list.targetBlue){
        values.selectDistr1 == list.distr1bl.nextvalue
    } else if (picture.target.currentvalue == list.targetGreen){
        values.selectDistr1 == list.distr1gr.nextvalue
    } else if (picture.target.currentvalue == list.targetRed){
        values.selectDistr1 == list.distr1re.nextvalue
    }
    
    //BLUE TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetBlue && values.selectDistr1 == list.distr1Green){
        values.selectDistr2 == list.distr2blgr.nextvalue
    } else if (picture.target.currentvalue == list.targetBlue && values.selectDistr1 == list.distr1Red){
        values.selectDistr2 == list.distr2blre.nextvalue
    }
    
    //GREEN TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetGreen && values.selectDistr1 == list.distr1Blue){
        values.selectDistr2 == list.distr2blgr.nextvalue
    } else if (picture.target.currentvalue == list.targetGreen && values.selectDistr1 == list.distr1Red){
        values.selectDistr2 == list.distr2grre.nextvalue
    }
    
    //RED TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetRed && values.selectDistr1 == list.distr1Blue){
        values.selectDistr2 == list.distr2blre.nextvalue
    } else if (picture.target.currentvalue == list.targetRed && values.selectDistr1 == list.distr1Green){
        values.selectDistr2 == list.distr2grre.nextvalue
    }
    
]

/ response = timeout(parameters.responseWindow)
/ validresponse = (parameters.blueKey, parameters.greenKey, parameters.redKey)
/ iscorrectresponse = [
    return (
    (values.currentTarget == 1 && trial.trial200.responsetext == parameters.blueKey) ||
    (values.currentTarget == 7 && trial.trial200.responsetext == parameters.blueKey) ||
    (values.currentTarget == 3 && trial.trial200.responsetext == parameters.greenKey) ||
    (values.currentTarget == 9 && trial.trial200.responsetext == parameters.greenKey) ||
    (values.currentTarget == 6 && trial.trial200.responsetext == parameters.redKey) ||
    (values.currentTarget == 12 && trial.trial200.responsetext == parameters.redKey))
    ]
    
/ stimulustimes = [0 = text.fixation;250 = picture.target, picture.distr1, picture.distr2; 1000 = shape.eraser; 1001 = picture.noisemask; 1501 = shape.eraser]

/ ontrialend = [
    
    //reset(list.distr1bl); reset(list.distr1gr); reset(list.distr1re);
    //reset(list.distr2blgr); reset(list.distr2blre); reset(list.distr2grre);
    //reset(list.xpos); reset(values.)
    
    values.selectDistr1 = 0;
    values.selectDistr2 = 0

]

</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: 105K
lukasg - 1/24/2022
lukasg - 1/24/2022
Hi All,

I am new to Inquisit and in the process of programming an illusory conjunction task. The paradigm involves the random presentation of three coloured letters flanked by two digits (see image: ). The letters are sampled from a target-population (e.g., X or N) and a distractor population (e.g., HSTO). On a given trial, the letters should be distinct in colour and letter. I am struggling to implement this characteristic in Inquisit and would greatly appreciate your help. 

Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours, I have switched to images and defined them as follows:

<item targets>
/1 = "Stimuli\nblue.png"
/2 = "Stimuli\ngreen.png"
...
</item>

<item distractors>
/1 = "Stimuli\oblue.png"
/2 = "Stimuli\ogreen.png"
...
</item>

<list xpos>
/items = (35%,50%,65%)
/ selectionrate = always
/ resetinterval = 0
</list>

<list target>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = trial
/ resetinterval = 0
</list>


Using this code, the pictures are sampled via values determined at the start of each trial (with ontrialstart), which looks like the following:

<picture target>
/ items = letters
/ select = list.target.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr1>
/ items = distractors
/ select = list.distractor1.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>

<picture distr2>
/ items = distractors
/ select = list.distractor2.nextvalue
/ erase = false
/ position = (list.xpos.nextvalue, 50%)
</picture>


The following if-functions are thought to limit the possible distractor space depending on the characteristics of the already selected stimuli. In theory that is, as the if-functions appear not to work as intended. Trials frequently feature stimuli with the same letter or colour. I hope the above code-chunks are sufficient, if not, please see the attached file with the entire script. Thanks in advance for your help!

All the best,
Lukas


This is trial-code, intended to update the values to sample the picture stimuli:

<trial trial200>
/ ontrialbegin = [
    values.selectTarget = list.target.nextvalue;
    values.currentTarget = values.selectTarget;
    
    if(values.selectTarget.currentvalue == 1 || values.selectTarget.currentvalue == 7){
        values.targetColor = "blue"
    } elese if (values.selectTarget.currentvalue == 3 || values.selectTarget.currentvalue == 9){
        values.targetColor = "green"
    } else if (values.selectTarget.currentvalue == 6 || values.selectTarget.currentvalue == 12){
        values.targetColor = "red"
    }
    
    list.xpos.reset();
    picture.target.hposition = list.xpos.nextvalue;
    picture.distr1.hposition = list.xpos.nextvalue;
    picture.distr2.hposition = list.xpos.nextvalue;
    
    //TARGET - SELECTION OF 1st DISTR
    if(picture.target.currentvalue == list.targetBlue){
        values.selectDistr1 == list.distr1bl.nextvalue
    } else if (picture.target.currentvalue == list.targetGreen){
        values.selectDistr1 == list.distr1gr.nextvalue
    } else if (picture.target.currentvalue == list.targetRed){
        values.selectDistr1 == list.distr1re.nextvalue
    }
    
    //BLUE TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetBlue && values.selectDistr1 == list.distr1Green){
        values.selectDistr2 == list.distr2blgr.nextvalue
    } else if (picture.target.currentvalue == list.targetBlue && values.selectDistr1 == list.distr1Red){
        values.selectDistr2 == list.distr2blre.nextvalue
    }
    
    //GREEN TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetGreen && values.selectDistr1 == list.distr1Blue){
        values.selectDistr2 == list.distr2blgr.nextvalue
    } else if (picture.target.currentvalue == list.targetGreen && values.selectDistr1 == list.distr1Red){
        values.selectDistr2 == list.distr2grre.nextvalue
    }
    
    //RED TARGET - SELECTION OF 2nd DISTR
    if(picture.target.currentvalue == list.targetRed && values.selectDistr1 == list.distr1Blue){
        values.selectDistr2 == list.distr2blre.nextvalue
    } else if (picture.target.currentvalue == list.targetRed && values.selectDistr1 == list.distr1Green){
        values.selectDistr2 == list.distr2grre.nextvalue
    }
    
]

/ response = timeout(parameters.responseWindow)
/ validresponse = (parameters.blueKey, parameters.greenKey, parameters.redKey)
/ iscorrectresponse = [
    return (
    (values.currentTarget == 1 && trial.trial200.responsetext == parameters.blueKey) ||
    (values.currentTarget == 7 && trial.trial200.responsetext == parameters.blueKey) ||
    (values.currentTarget == 3 && trial.trial200.responsetext == parameters.greenKey) ||
    (values.currentTarget == 9 && trial.trial200.responsetext == parameters.greenKey) ||
    (values.currentTarget == 6 && trial.trial200.responsetext == parameters.redKey) ||
    (values.currentTarget == 12 && trial.trial200.responsetext == parameters.redKey))
    ]
    
/ stimulustimes = [0 = text.fixation;250 = picture.target, picture.distr1, picture.distr2; 1000 = shape.eraser; 1001 = picture.noisemask; 1501 = shape.eraser]

/ ontrialend = [
    
    //reset(list.distr1bl); reset(list.distr1gr); reset(list.distr1re);
    //reset(list.distr2blgr); reset(list.distr2blre); reset(list.distr2grre);
    //reset(list.xpos); reset(values.)
    
    values.selectDistr1 = 0;
    values.selectDistr2 = 0

]

</trial>


> Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours

What makes you think that?
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/24/2022

> Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours

What makes you think that?

This forum entry from a few years back. However, I am more than happy to explore alternative avenues in setting up an illusory conjunction task.

lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
lukasg - 1/24/2022
Dave - 1/24/2022

> Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours

What makes you think that?

This forum entry from a few years back. However, I am more than happy to explore alternative avenues in setting up an illusory conjunction task.

https://www.millisecond.com/forums/Topic18657.aspx
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: 105K
lukasg - 1/24/2022
lukasg - 1/24/2022
Dave - 1/24/2022

> Since Inquisit seems unable to present separate text-items in combination or a text-element with different colours

What makes you think that?

This forum entry from a few years back. However, I am more than happy to explore alternative avenues in setting up an illusory conjunction task.

https://www.millisecond.com/forums/Topic18657.aspx

This pertained to a case where you have a single <text> element and want to display single letters or words of a given *item* in different colors than the rest of the item's words or letters. That wasn't possible back then (though it is now). You, however, have separate <text> elements for target and distractors anyway, which can easily be displayed in different colors, that was possible even back then and of course still is.

lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/24/2022

This pertained to a case where you have a single <text> element and want to display single letters or words of a given *item* in different colors than the rest of the item's words or letters. That wasn't possible back then (though it is now). You, however, have separate <text> elements for target and distractors anyway, which can easily be displayed in different colors, that was possible even back then and of course still is.

Thanks for your response, Dave. Would you be able to demonstrate how this could be achieved? My previous attempts have been without success :/
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: 105K
lukasg - 1/24/2022
Dave - 1/24/2022

This pertained to a case where you have a single <text> element and want to display single letters or words of a given *item* in different colors than the rest of the item's words or letters. That wasn't possible back then (though it is now). You, however, have separate <text> elements for target and distractors anyway, which can easily be displayed in different colors, that was possible even back then and of course still is.

Thanks for your response, Dave. Would you be able to demonstrate how this could be achieved? My previous attempts have been without success :/

Here's a basic example:

<defaults>
/ fontstyle = ("Arial", 5%, true)
</defaults>

<values>
/ t = 0
/ t_x = 0
/ t_color = black
/ d1 = 0
/ d1_x = 0
/ d1_color = black
/ d2 = 0
/ d2_x = 0
/ d2_color = black
</values>

<text t>
/ items = targets
/ select = values.t
/ hposition = values.t_x
/ txcolor = values.t_color
/ erase = false
</text>

<item targets>
/ 1 = "N"
/ 2 = "X"
</item>

<text d1>
/ items = distractors
/ select = values.d1
/ hposition = values.d1_x
/ txcolor = values.d1_color
/ erase = false
</text>

<text d2>
/ items = distractors
/ select = values.d2
/ hposition = values.d2_x
/ txcolor = values.d2_color
/ erase = false
</text>

<item distractors>
/ 1 = "H"
/ 1 = "S"
/ 1 = "T"
/ 1 = "O"
</item>

// 30 trials in this example,
// 15 x target 1 ("N")
// 15 x target 2 ("X")
<list t_items>
/ items = (1,2)
/ poolsize = 10
</list>

// two distractors sampled per trial at random
<list d_items>
/ items = (1,2,3,4)
/ selectionrate = always
</list>

// 30 trials in this example,
// target 10 x in left position,
// target 10 x in middle position,
// target 10 x in right position
<list t_x>
/ items = (40%, 50%, 60%)
/ poolsize = 30
</list>

// random position for two distractors, not equal to target position
<list d_x>
/ items = (40%, 50%, 60%)
/ selectionrate = always
/ not = (values.t_x)
</list>

// 30 trials in this example,
// target 10 x in red,
// target 10 x in green,
// target 10 x in blue,
<list t_colors>
/ items = (red, green, blue)
/ poolsize = 30
</list>

// random colors for two distractors, not equal to target color
<list d_colors>
/ items = (red, green, blue)
/ selectionrate = always
/ not = (values.t_color)
</list>

<trial example>
/ ontrialbegin = [
    // select target item
    values.t = list.t_items.nextvalue;
    // select distractor items
    values.d1 = list.d_items.nextvalue;
    values.d2 = list.d_items.nextvalue;
    // select target position
    values.t_x = list.t_x.nextvalue;
    // select distractor positions
    values.d1_x = list.d_x.nextvalue;
    values.d2_x = list.d_x.nextvalue;
    // select target color
    values.t_color = list.t_colors.nextvalue;
    // select distractor colors
    values.d1_color = list.d_colors.nextvalue;
    values.d2_color = list.d_colors.nextvalue;
]

/ ontrialend = [
    // reset relevant lists for next trial
    list.d_items.reset();
    list.d_x.reset();
    list.d_colors.reset();
]

/ stimulusframes = [1=clearscreen, t, d1, d2]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-30 = example]
</block>


lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/24/2022

Here's a basic example:

<defaults>
/ fontstyle = ("Arial", 5%, true)
</defaults>

<values>
/ t = 0
/ t_x = 0
/ t_color = black
/ d1 = 0
/ d1_x = 0
/ d1_color = black
/ d2 = 0
/ d2_x = 0
/ d2_color = black
</values>

<text t>
/ items = targets
/ select = values.t
/ hposition = values.t_x
/ txcolor = values.t_color
/ erase = false
</text>

<item targets>
/ 1 = "N"
/ 2 = "X"
</item>

<text d1>
/ items = distractors
/ select = values.d1
/ hposition = values.d1_x
/ txcolor = values.d1_color
/ erase = false
</text>

<text d2>
/ items = distractors
/ select = values.d2
/ hposition = values.d2_x
/ txcolor = values.d2_color
/ erase = false
</text>

<item distractors>
/ 1 = "H"
/ 1 = "S"
/ 1 = "T"
/ 1 = "O"
</item>

// 30 trials in this example,
// 15 x target 1 ("N")
// 15 x target 2 ("X")
<list t_items>
/ items = (1,2)
/ poolsize = 10
</list>

// two distractors sampled per trial at random
<list d_items>
/ items = (1,2,3,4)
/ selectionrate = always
</list>

// 30 trials in this example,
// target 10 x in left position,
// target 10 x in middle position,
// target 10 x in right position
<list t_x>
/ items = (40%, 50%, 60%)
/ poolsize = 30
</list>

// random position for two distractors, not equal to target position
<list d_x>
/ items = (40%, 50%, 60%)
/ selectionrate = always
/ not = (values.t_x)
</list>

// 30 trials in this example,
// target 10 x in red,
// target 10 x in green,
// target 10 x in blue,
<list t_colors>
/ items = (red, green, blue)
/ poolsize = 30
</list>

// random colors for two distractors, not equal to target color
<list d_colors>
/ items = (red, green, blue)
/ selectionrate = always
/ not = (values.t_color)
</list>

<trial example>
/ ontrialbegin = [
    // select target item
    values.t = list.t_items.nextvalue;
    // select distractor items
    values.d1 = list.d_items.nextvalue;
    values.d2 = list.d_items.nextvalue;
    // select target position
    values.t_x = list.t_x.nextvalue;
    // select distractor positions
    values.d1_x = list.d_x.nextvalue;
    values.d2_x = list.d_x.nextvalue;
    // select target color
    values.t_color = list.t_colors.nextvalue;
    // select distractor colors
    values.d1_color = list.d_colors.nextvalue;
    values.d2_color = list.d_colors.nextvalue;
]

/ ontrialend = [
    // reset relevant lists for next trial
    list.d_items.reset();
    list.d_x.reset();
    list.d_colors.reset();
]

/ stimulusframes = [1=clearscreen, t, d1, d2]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-30 = example]
</block>


Thanks! Sadly, this would have taken me hours. One additional question, if I want the correct response to be conditional on the colour of the presented target, how would I equate the different colours to the different response keys?
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: 105K
lukasg - 1/24/2022
Dave - 1/24/2022

Here's a basic example:

<defaults>
/ fontstyle = ("Arial", 5%, true)
</defaults>

<values>
/ t = 0
/ t_x = 0
/ t_color = black
/ d1 = 0
/ d1_x = 0
/ d1_color = black
/ d2 = 0
/ d2_x = 0
/ d2_color = black
</values>

<text t>
/ items = targets
/ select = values.t
/ hposition = values.t_x
/ txcolor = values.t_color
/ erase = false
</text>

<item targets>
/ 1 = "N"
/ 2 = "X"
</item>

<text d1>
/ items = distractors
/ select = values.d1
/ hposition = values.d1_x
/ txcolor = values.d1_color
/ erase = false
</text>

<text d2>
/ items = distractors
/ select = values.d2
/ hposition = values.d2_x
/ txcolor = values.d2_color
/ erase = false
</text>

<item distractors>
/ 1 = "H"
/ 1 = "S"
/ 1 = "T"
/ 1 = "O"
</item>

// 30 trials in this example,
// 15 x target 1 ("N")
// 15 x target 2 ("X")
<list t_items>
/ items = (1,2)
/ poolsize = 10
</list>

// two distractors sampled per trial at random
<list d_items>
/ items = (1,2,3,4)
/ selectionrate = always
</list>

// 30 trials in this example,
// target 10 x in left position,
// target 10 x in middle position,
// target 10 x in right position
<list t_x>
/ items = (40%, 50%, 60%)
/ poolsize = 30
</list>

// random position for two distractors, not equal to target position
<list d_x>
/ items = (40%, 50%, 60%)
/ selectionrate = always
/ not = (values.t_x)
</list>

// 30 trials in this example,
// target 10 x in red,
// target 10 x in green,
// target 10 x in blue,
<list t_colors>
/ items = (red, green, blue)
/ poolsize = 30
</list>

// random colors for two distractors, not equal to target color
<list d_colors>
/ items = (red, green, blue)
/ selectionrate = always
/ not = (values.t_color)
</list>

<trial example>
/ ontrialbegin = [
    // select target item
    values.t = list.t_items.nextvalue;
    // select distractor items
    values.d1 = list.d_items.nextvalue;
    values.d2 = list.d_items.nextvalue;
    // select target position
    values.t_x = list.t_x.nextvalue;
    // select distractor positions
    values.d1_x = list.d_x.nextvalue;
    values.d2_x = list.d_x.nextvalue;
    // select target color
    values.t_color = list.t_colors.nextvalue;
    // select distractor colors
    values.d1_color = list.d_colors.nextvalue;
    values.d2_color = list.d_colors.nextvalue;
]

/ ontrialend = [
    // reset relevant lists for next trial
    list.d_items.reset();
    list.d_x.reset();
    list.d_colors.reset();
]

/ stimulusframes = [1=clearscreen, t, d1, d2]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-30 = example]
</block>


Thanks! Sadly, this would have taken me hours. One additional question, if I want the correct response to be conditional on the colour of the presented target, how would I equate the different colours to the different response keys?

You can easily integrate that into the existing logic.

<defaults>
/ fontstyle = ("Arial", 5%, true)
</defaults>

<values>
/ t = 0
/ t_x = 0
/ t_color = black
/ d1 = 0
/ d1_x = 0
/ d1_color = black
/ d2 = 0
/ d2_x = 0
/ d2_color = black

/ cresp = " "
</values>

<text t>
/ items = targets
/ select = values.t
/ hposition = values.t_x
/ txcolor = values.t_color
/ erase = false
</text>

<item targets>
/ 1 = "N"
/ 2 = "X"
</item>

<text d1>
/ items = distractors
/ select = values.d1
/ hposition = values.d1_x
/ txcolor = values.d1_color
/ erase = false
</text>

<text d2>
/ items = distractors
/ select = values.d2
/ hposition = values.d2_x
/ txcolor = values.d2_color
/ erase = false
</text>

<item distractors>
/ 1 = "H"
/ 1 = "S"
/ 1 = "T"
/ 1 = "O"
</item>

// 30 trials in this example,
// 15 x target 1 ("N")
// 15 x target 2 ("X")
<list t_items>
/ items = (1,2)
/ poolsize = 10
</list>

// two distractors sampled per trial at random
<list d_items>
/ items = (1,2,3,4)
/ selectionrate = always
</list>

// 30 trials in this example,
// target 10 x in left position,
// target 10 x in middle position,
// target 10 x in right position
<list t_x>
/ items = (40%, 50%, 60%)
/ poolsize = 30
</list>

// random position for two distractors, not equal to target position
<list d_x>
/ items = (40%, 50%, 60%)
/ selectionrate = always
/ not = (values.t_x)
</list>

// 30 trials in this example,
// target 10 x in red,
// target 10 x in green,
// target 10 x in blue,
<list t_colors>
/ items = (red, green, blue)
/ poolsize = 30
</list>

// random colors for two distractors, not equal to target color
<list d_colors>
/ items = (red, green, blue)
/ selectionrate = always
/ not = (values.t_color)
</list>

<trial example>
/ ontrialbegin = [
    // select target item
    values.t = list.t_items.nextvalue;
    // select distractor items
    values.d1 = list.d_items.nextvalue;
    values.d2 = list.d_items.nextvalue;
    // select target position
    values.t_x = list.t_x.nextvalue;
    // select distractor positions
    values.d1_x = list.d_x.nextvalue;
    values.d2_x = list.d_x.nextvalue;
    // select target color
    values.t_color = list.t_colors.nextvalue;
    // and corresponding response key
    if (values.t_color == red) {
        values.cresp = "R";
    } else if (values.t_color == green) {
        values.cresp = "G";
    } else if (values.t_color == blue) {
        values.cresp = "B";
    };
    // select distractor colors
    values.d1_color = list.d_colors.nextvalue;
    values.d2_color = list.d_colors.nextvalue;
]

/ ontrialend = [
    // reset relevant lists for next trial
    list.d_items.reset();
    list.d_x.reset();
    list.d_colors.reset();
]

/ stimulusframes = [1=clearscreen, t, d1, d2]
/ validresponse = ("R", "G", "B")
/ correctresponse = (values.cresp)
</trial>

<block myblock>
/ trials = [1-30 = example]
/ correctmessage = true(correctmsg, 500)
/ errormessage = true(errormsg, 500)
</block>

<text correctmsg>
/ items = ("CORRECT")
/ color = green
/ position = (50%, 80%)
/ erase = false
</text>

<text errormsg>
/ items = ("WRONG")
/ color = red
/ position = (50%, 80%)
/ erase = false
</text>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search