Randomly assigning colors to texts


Author
Message
mariela
mariela
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 14, Visits: 25
Dear all,

I have another question in regards to my experiment:
In my experiment I have 4 blocks of stimuli items. Now I would like to randomly assign 1 of 4 colors to the blocks.

I tried to do this by defining a value label and then put the <%value.color_1%> into the elemtnes defining the text:

<values >
/ color_1=noreplace((10,10,0),(0,10,10),(10,0,10),(10,10,10))
</values>

<text A> 
/ items = A
/color = <%values.color_1%>
</text>

<text B>
/ items = B
/ color = <%values.color_1%>
</text>

<text C>
/ items = C
/color = <%values.color_1%>
</text>

<text D>
/ items = D
/color = <%values.color_1%>
</text>

Unfortunately this is not working. The message list errors tells me that "Expression '<%values.color_A%' is invalid. Expression contains a syntax error."
Can you help me with this task? Is it correct to assign colors by using the value-function?

Thank you so much in advance!!



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 95K
> Does your syntax still apply in this situation or do I need to do something different?

Yes it does, it's the same thing:

<block myblock>
/ onblockbegin = [text.object1.textcolorred=list.r.nextvalue;
    text.object1.textcolorgreen=list.g.nextvalue;
    text.object1.textcolorblue=list.b.nextvalue]
/ onblockbegin = [text.object2.textcolorred=list.r.nextvalue;
    text.object2.textcolorgreen=list.g.nextvalue;
    text.object2.textcolorblue=list.b.nextvalue]
/ trials = [1-4=noreplace(object1trial, object2trial)]
</block>

<trial object1trial>
/ stimulusframes = [1=object1]
/ validresponse = (57)
</trial>

<text object1>
/ items = object1items
</text>

<item object1items>
/ 1 = "Hi, I'm Object1. My color is R=<%text.object1.textcolorred%> G=<%text.object1.textcolorgreen%> B=<%text.object1.textcolorblue%>."
/ 2 = "Hey, it's Object1. The color is R=<%text.object1.textcolorred%> G=<%text.object1.textcolorgreen%> B=<%text.object1.textcolorblue%>."
</item>

<trial object2trial>
/ stimulusframes = [1=object2]
/ validresponse = (57)
</trial>

<text object2>
/ items = object2items
</text>

<item object2items>
/ 1 = "Me, I'm Object2. The color is R=<%text.object2.textcolorred%> G=<%text.object2.textcolorgreen%> B=<%text.object2.textcolorblue%>."
/ 2 = "Hello, it's Object2 speaking. Observe my color R=<%text.object2.textcolorred%> G=<%text.object2.textcolorgreen%> B=<%text.object2.textcolorblue%>."
</item>

<list r>
/ items = (255, 0)
/ selectionmode = random
/ selectionrate = always
</list>

<list g>
/ items = (128, 255)
/ selectionmode = list.r.currentindex
/ selectionrate = always
</list>

<list b>
/ items = (0, 128)
/ selectionmode = list.r.currentindex
/ selectionrate = always
</list>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search