Randomly varying color of anagrams


Author
Message
nncheek
nncheek
Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)
Group: Forum Members
Posts: 8, Visits: 31
Hello,
I'm trying to design an experiment where participants first solve a series of anagrams, each of which is presented in a color. In a perfect world, the color of each anagram would be randomly selected from a set of possible colors (e.g., five possible colors). After they have solved all the anagrams, participants would then be presented with an unexpected quiz--they would be asked what color each anagram was, one by one. For instance, if the first anagram they had solved was RETE (unscrambles to TREE) was in green, they would receive a question asking them if it was green or pink (i.e., choosing between the correct color and a distractor color). I've been working off of the anagram study template available through Inquisit's website, but I'm kind of at a loss about how to do this. How do I get a list of text stimuli to randomly vary in color and how to I get my subsequent quiz to present to possible color options for each anagram, the right color (which was randomly chosen so I can't just use a default question?) and a randomly paired distractor? Any help would be much appreciated!! Thanks!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
You'll want to both sample a random color for the anagram text from a list as well as then store the sampled anagram item and its (randomly assigned) color to another set of linked lists at runtime. You then use that latter set of lists for selection in the quiz block. In a nutshell:

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [text.anagram.textcolor = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=anagram]
/ position = (50%, 60%)
</openended>

//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = list.record_anagram_item.currentindex
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.record_displaycolor.nextvalue)
</list>


<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = list.record_anagram_item.nextvalue
</text>

<text correctcolor>
/ items = colornames
/ position = (25%, 60%)
/ select = list.record_displaycolor.nextvalue
</text>

<text distractorcolor>
/ items = colornames
/ position = (75%, 60%)
/ select = list.distractor_color.nextvalue
</text>

<item colornames>
/ 1 = "Red"
/ 2 = "Green"
/ 3 = "Blue"
</item>

Hope this helps.

nncheek
nncheek
Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)
Group: Forum Members
Posts: 8, Visits: 31
Thank you so much! This was incredibly helpful.
nncheek
nncheek
Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)
Group: Forum Members
Posts: 8, Visits: 31
Hi Dave,
I was hoping to now change the experiment so that instead of the text color of anagrams changing color, the screen background changes color (i.e., all text would now be black, but the color of the background would vary randomly and then be the subject of the quiz). It seems like that should be fairly straightforward given the script you generously provided, but I'm having trouble figuring out where to make the appropriate changes. Could you point me in the right direction?
Many thanks!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
nncheek - Monday, November 07, 2016
Hi Dave,
I was hoping to now change the experiment so that instead of the text color of anagrams changing color, the screen background changes color (i.e., all text would now be black, but the color of the background would vary randomly and then be the subject of the quiz). It seems like that should be fairly straightforward given the script you generously provided, but I'm having trouble figuring out where to make the appropriate changes. Could you point me in the right direction?
Many thanks!

You would create a <shape> that covers the entire screen and display that shape along with the black text in the <trial>. You would change the <shape>'s color in the same way the <text> element's color was changed the previous example on a trial-by-trial basis.

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [shape.background.color = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=background, anagram]
/ position = (50%, 60%)
</openended>

<shape background>
/ shape = rectangle
/ size = (100%, 100%)
/ color = black
</shape>


//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
/ txbgcolor = transparent
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = list.record_anagram_item.currentindex
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.record_displaycolor.nextvalue)
</list>


<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = list.record_anagram_item.nextvalue
</text>

<text correctcolor>
/ items = colornames
/ position = (25%, 60%)
/ select = list.record_displaycolor.nextvalue
</text>

<text distractorcolor>
/ items = colornames
/ position = (75%, 60%)
/ select = list.distractor_color.nextvalue
</text>

<item colornames>
/ 1 = "Red"
/ 2 = "Green"
/ 3 = "Blue"
</item>

nncheek
nncheek
Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)
Group: Forum Members
Posts: 8, Visits: 31
Dave - Monday, November 07, 2016
nncheek - Monday, November 07, 2016
Hi Dave,
I was hoping to now change the experiment so that instead of the text color of anagrams changing color, the screen background changes color (i.e., all text would now be black, but the color of the background would vary randomly and then be the subject of the quiz). It seems like that should be fairly straightforward given the script you generously provided, but I'm having trouble figuring out where to make the appropriate changes. Could you point me in the right direction?
Many thanks!

You would create a <shape> that covers the entire screen and display that shape along with the black text in the <trial>. You would change the <shape>'s color in the same way the <text> element's color was changed the previous example on a trial-by-trial basis.

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [shape.background.color = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=background, anagram]
/ position = (50%, 60%)
</openended>

<shape background>
/ shape = rectangle
/ size = (100%, 100%)
/ color = black
</shape>


//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
/ txbgcolor = transparent
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = list.record_anagram_item.currentindex
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.record_displaycolor.nextvalue)
</list>


<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = list.record_anagram_item.nextvalue
</text>

<text correctcolor>
/ items = colornames
/ position = (25%, 60%)
/ select = list.record_displaycolor.nextvalue
</text>

<text distractorcolor>
/ items = colornames
/ position = (75%, 60%)
/ select = list.distractor_color.nextvalue
</text>

<item colornames>
/ 1 = "Red"
/ 2 = "Green"
/ 3 = "Blue"
</item>

This has been super helpful so far--and I've come back to ask for further help. If for the quiz portion, if instead of having the options participants can pick from be words (i.e., the colors), I want them to be, say, squares that match the color options (so, a blue square instead of text saying BLUE), would I just make new shape stimuli and then change the items under the quiz trial? What do you think is the best way to do that?
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
nncheek - Sunday, November 27, 2016
Dave - Monday, November 07, 2016
nncheek - Monday, November 07, 2016
Hi Dave,
I was hoping to now change the experiment so that instead of the text color of anagrams changing color, the screen background changes color (i.e., all text would now be black, but the color of the background would vary randomly and then be the subject of the quiz). It seems like that should be fairly straightforward given the script you generously provided, but I'm having trouble figuring out where to make the appropriate changes. Could you point me in the right direction?
Many thanks!

You would create a <shape> that covers the entire screen and display that shape along with the black text in the <trial>. You would change the <shape>'s color in the same way the <text> element's color was changed the previous example on a trial-by-trial basis.

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [shape.background.color = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=background, anagram]
/ position = (50%, 60%)
</openended>

<shape background>
/ shape = rectangle
/ size = (100%, 100%)
/ color = black
</shape>


//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
/ txbgcolor = transparent
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = list.record_anagram_item.currentindex
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.record_displaycolor.nextvalue)
</list>


<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = list.record_anagram_item.nextvalue
</text>

<text correctcolor>
/ items = colornames
/ position = (25%, 60%)
/ select = list.record_displaycolor.nextvalue
</text>

<text distractorcolor>
/ items = colornames
/ position = (75%, 60%)
/ select = list.distractor_color.nextvalue
</text>

<item colornames>
/ 1 = "Red"
/ 2 = "Green"
/ 3 = "Blue"
</item>

This has been super helpful so far--and I've come back to ask for further help. If for the quiz portion, if instead of having the options participants can pick from be words (i.e., the colors), I want them to be, say, squares that match the color options (so, a blue square instead of text saying BLUE), would I just make new shape stimuli and then change the items under the quiz trial? What do you think is the best way to do that?

Yes. Use <shape> elements and set their respective color properties as needed.

nncheek
nncheek
Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)Esteemed Member (1.7K reputation)
Group: Forum Members
Posts: 8, Visits: 31
 So, I added three shapes and tried to make it so that the quiz shows three squares as possible options (one for the correct color background on the anagram trial, and two distractor/wrong answer colors), each of which should be a different color, with only one color being correct. I used the code you had provided, with new shapes and this new list for the second shape color (probably done incorrectly), and then I edited the quiz trial as shown below, but now when I run it I only see one black box in the middle (50, 60) on the first quiz trial and then no boxes on the second quiz trial. I also get this error message: Failed to set the value of property 'color' on element 'shape.correctcolor'.

Can you help me figure out what’s wrong here? I’m also worried that the shapes will always appear in the same place (i.e., the correct answer will always be in the same place), but ideally they’d be randomly positioned, though I’m not sure how to do that.

<list distractor2_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.distractor_color.nextvalue;list.record_displaycolor.nextvalue)
</list>

<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractor2_color, quit]
/ ontrialbegin = [shape.correctcolor.color = list.record_displaycolor.nextvalue; shape.distractorcolor.color=list.distractor_color.nextvalue;
            shape.distractor2_color.color=list.distractor2_color.nextvalue; quit
           
]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractor2_color)
/ correctresponse = (correctcolor)
</trial>

<shape distractor2_color>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (20%, 60%)
</shape>

<shape correctcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (50%, 60%)
</shape>

<shape distractorcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (80%, 60%)
</shape>



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
nncheek - Thursday, December 01, 2016
 So, I added three shapes and tried to make it so that the quiz shows three squares as possible options (one for the correct color background on the anagram trial, and two distractor/wrong answer colors), each of which should be a different color, with only one color being correct. I used the code you had provided, with new shapes and this new list for the second shape color (probably done incorrectly), and then I edited the quiz trial as shown below, but now when I run it I only see one black box in the middle (50, 60) on the first quiz trial and then no boxes on the second quiz trial. I also get this error message: Failed to set the value of property 'color' on element 'shape.correctcolor'.

Can you help me figure out what’s wrong here? I’m also worried that the shapes will always appear in the same place (i.e., the correct answer will always be in the same place), but ideally they’d be randomly positioned, though I’m not sure how to do that.

<list distractor2_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.distractor_color.nextvalue;list.record_displaycolor.nextvalue)
</list>

<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractor2_color, quit]
/ ontrialbegin = [shape.correctcolor.color = list.record_displaycolor.nextvalue; shape.distractorcolor.color=list.distractor_color.nextvalue;
            shape.distractor2_color.color=list.distractor2_color.nextvalue; quit
           
]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractor2_color)
/ correctresponse = (correctcolor)
</trial>

<shape distractor2_color>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (20%, 60%)
</shape>

<shape correctcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (50%, 60%)
</shape>

<shape distractorcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (80%, 60%)
</shape>



What you do is essentially this (essential changes from the example using <text> elements in bold):

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [text.anagram.textcolor = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=anagram]
/ position = (50%, 60%)
</openended>

//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = values.anagram_item
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = false
/ selectionrate = always
/ not = (list.record_displaycolor.nextvalue)
</list>

<trial quiztrial>
/ ontrialbegin = [values.anagram_item = list.record_anagram_item.nextvalue;
    shape.correctcolor.color = list.colors.item(list.record_displaycolor.nextvalue);
    shape.distractorcolor.color = list.colors.item(list.distractor_color.nextvalue);
    shape.distractorcolor2.color = list.colors.item(list.distractor_color.nextvalue);
]
/ ontrialend = [
    list.distractor_color.reset();
]

/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractorcolor2]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractorcolor2)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = values.anagram_item
</text>

<shape correctcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<shape distractorcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<shape distractorcolor2>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<list colors>
/ items = (red, green, blue)
</list>


<list random_hposition>
/ items = (25%, 50%, 75%)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>


<values>
/ anagram_item = 0
</values>


Hold off a second; there's some stupid bug in the above code. Let me work out the kink and post an amended version ASAP.

(The general approach is valid, though.)


Edited 8 Years Ago by Dave
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
Dave - Thursday, December 01, 2016
nncheek - Thursday, December 01, 2016
 So, I added three shapes and tried to make it so that the quiz shows three squares as possible options (one for the correct color background on the anagram trial, and two distractor/wrong answer colors), each of which should be a different color, with only one color being correct. I used the code you had provided, with new shapes and this new list for the second shape color (probably done incorrectly), and then I edited the quiz trial as shown below, but now when I run it I only see one black box in the middle (50, 60) on the first quiz trial and then no boxes on the second quiz trial. I also get this error message: Failed to set the value of property 'color' on element 'shape.correctcolor'.

Can you help me figure out what’s wrong here? I’m also worried that the shapes will always appear in the same place (i.e., the correct answer will always be in the same place), but ideally they’d be randomly positioned, though I’m not sure how to do that.

<list distractor2_color>
/ items = (1,2,3)
/ replace = true
/ not = (list.distractor_color.nextvalue;list.record_displaycolor.nextvalue)
</list>

<trial quiztrial>
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractor2_color, quit]
/ ontrialbegin = [shape.correctcolor.color = list.record_displaycolor.nextvalue; shape.distractorcolor.color=list.distractor_color.nextvalue;
            shape.distractor2_color.color=list.distractor2_color.nextvalue; quit
           
]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractor2_color)
/ correctresponse = (correctcolor)
</trial>

<shape distractor2_color>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (20%, 60%)
</shape>

<shape correctcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (50%, 60%)
</shape>

<shape distractorcolor>
/shape=rectangle
/ size = (15%, 15%)
/ color = black
/position = (80%, 60%)
</shape>



What you do is essentially this (essential changes from the example using <text> elements in bold):

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [text.anagram.textcolor = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ stimulusframes = [1=anagram]
/ position = (50%, 60%)
</openended>

//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = values.anagram_item
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = false
/ selectionrate = always
/ not = (list.record_displaycolor.nextvalue)
</list>

<trial quiztrial>
/ ontrialbegin = [values.anagram_item = list.record_anagram_item.nextvalue;
    shape.correctcolor.color = list.colors.item(list.record_displaycolor.nextvalue);
    shape.distractorcolor.color = list.colors.item(list.distractor_color.nextvalue);
    shape.distractorcolor2.color = list.colors.item(list.distractor_color.nextvalue);
]
/ ontrialend = [
    list.distractor_color.reset();
]

/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractorcolor2]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractorcolor2)
/ correctresponse = (correctcolor)
</trial>

<text recall_anagram>
/ items = anagramitems
/ select = values.anagram_item
</text>

<shape correctcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<shape distractorcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<shape distractorcolor2>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = list.random_hposition.nextvalue

</shape>

<list colors>
/ items = (red, green, blue)
</list>


<list random_hposition>
/ items = (25%, 50%, 75%)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>


<values>
/ anagram_item = 0
</values>


Hold off a second; there's some stupid bug in the above code. Let me work out the kink and post an amended version ASAP.

(The general approach is valid, though.)


Here we go. Apologies for the confusion. For testing purposes -- so you can check that things work -- respond in the anagram trials with something like "a = red; " if Anagram A was displayed in the color red.

<expt >
/ blocks = [1=anagramblock; 2=quizblock]
</expt>

<block anagramblock>
/ trials = [1-3 = anagramtrial]
</block>

<block quizblock>
/ trials = [1-3 = quiztrial]
</block>

//set the anagram text's color to a random value sampled from a list
//store anagram item number & associated display color in empty lists
//at runtime
<openended anagramtrial>
/ ontrialbegin = [text.anagram.textcolor = list.random_anagramcolor.nextvalue;]
/ ontrialend = [list.record_anagram_item.appenditem(text.anagram.currentindex);
    list.record_displaycolor.appenditem(list.random_anagramcolor.currentindex);
    ]
/ ontrialend = [
    values.responses = concat(values.responses, openended.anagramtrial.response);
]
/ stimulusframes = [1=anagram]
/ position = (50%, 60%)
</openended>

//random colors for the anagram text
<list random_anagramcolor>
/ items = (red, green, blue)
</list>

<text anagram>
/ items = anagramitems
</text>

<item anagramitems>
/ 1 = "Anagram A"
/ 2 = "Anagram B"
/ 3 = "Anagram C"
</item>

//lists to store the anagram item number
//and associated randomly selected display color
//those will be used for selection in the quiz block
<list record_anagram_item>
</list>

<list record_displaycolor>
/ selectionmode = list.record_anagram_item.currentindex
</list>

//select a distractor color in quiz trials
//selection must *not* be same as in list.record_displaycolor
<list distractor_color>
/ items = (1,2,3)
/ replace = false
/ selectionrate = always
/ not = (list.record_displaycolor.nextvalue)
</list>


<trial quiztrial>
/ ontrialbegin = [values.anagram_item = list.record_anagram_item.nextvalue;
    shape.correctcolor.color = list.colors.item(list.record_displaycolor.nextvalue);
    shape.distractorcolor.color = list.colors.item(list.distractor_color.nextvalue);
    shape.distractorcolor2.color = list.colors.item(list.distractor_color.nextvalue);
]
/ ontrialbegin = [
    values.correct_h = list.random_hposition.nextvalue;
    values.dist1_h = list.random_hposition.nextvalue;
    values.dist2_h = list.random_hposition.nextvalue;
]
/ ontrialend = [
    list.distractor_color.reset();
]
/ stimulusframes = [1=recall_anagram, correctcolor, distractorcolor, distractorcolor2, debug]
/ inputdevice = mouse
/ validresponse = (correctcolor, distractorcolor, distractorcolor2)
/ correctresponse = (correctcolor)
</trial>

<text debug>
/ items = ("<%values.responses%> Horizontal position of correct stimulus: <%values.correct_h%>")
/ position = (50%, 10%)
</text>

<text recall_anagram>
/ items = anagramitems
/ select = values.anagram_item
</text>

<shape correctcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = values.correct_h
</shape>

<shape distractorcolor>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = values.dist1_h
</shape>

<shape distractorcolor2>
/ shape = rectangle
/ size = (100px, 100px)
/ vposition = 60%
/ hposition = values.dist2_h
</shape>

<list colors>
/ items = (red, green, blue)
</list>

<list random_hposition>
/ items = (25%, 50%, 75%)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>

<values>
/ anagram_item = 0
/ correct_h = 0%
/ dist1_h = 0%
/ dist2_h = 0%
/ responses = ""
</values>

<data>
/ separatefiles = true
</data>



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search