Millisecond Forums

randomly varying the parts of the text item

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

By deh - 10/15/2020

Hi,

Is there a way to randomly vary some part of the text item? I would like to randomly present a description of a person, but at the same time vary their names.
I know that I could do this by just making two sets of text. However, in this case, there is a problem with positioning the names and the descriptions, because the lengths of names and descriptions vary, and therefore, the positions need to be adjusted per item accordingly.

So I was wondering if there's a way to randomly vary the name part of each description item, and track which name was presented for each trial.

Thank you!

By Dave - 10/16/2020

deh - 10/16/2020
Hi,

Is there a way to randomly vary some part of the text item? I would like to randomly present a description of a person, but at the same time vary their names.
I know that I could do this by just making two sets of text. However, in this case, there is a problem with positioning the names and the descriptions, because the lengths of names and descriptions vary, and therefore, the positions need to be adjusted per item accordingly.

So I was wondering if there's a way to randomly vary the name part of each description item, and track which name was presented for each trial.

Thank you!


<values>
/ currentname = ""
/ currentage = 0
</values>

<list randomnames>
/ items = ("Anna", "Barbara")
</list>

<list randomages>
/ items = ("24", "53")
/ selectionmode = list.randomnames.currentindex
</list>

<expt>
/ blocks = [1-2 = example]
</expt>

<block example>
/ onblockbegin = [
    values.currentname = list.randomnames.nextvalue;
    values.currentage = list.randomages.nextvalue;
]
/ trials = [1-2 = exampletrial]
</block>

<trial exampletrial>
/ stimulusframes = [1=description]
/ validresponse = (57)
</trial>

<text description>
/ items = descriptionitems
/ select = sequence
</text>

<item descriptionitems>
/ 1 = "This is <%values.currentname%>."
/ 2 = "<%values.currentname%> is <%values.currentage%> years old."
</item>

By Dave - 10/16/2020

Dave - 10/16/2020
deh - 10/16/2020
Hi,

Is there a way to randomly vary some part of the text item? I would like to randomly present a description of a person, but at the same time vary their names.
I know that I could do this by just making two sets of text. However, in this case, there is a problem with positioning the names and the descriptions, because the lengths of names and descriptions vary, and therefore, the positions need to be adjusted per item accordingly.

So I was wondering if there's a way to randomly vary the name part of each description item, and track which name was presented for each trial.

Thank you!


<values>
/ currentname = ""
/ currentage = 0
</values>

<list randomnames>
/ items = ("Anna", "Barbara")
</list>

<list randomages>
/ items = ("24", "53")
/ selectionmode = list.randomnames.currentindex
</list>

<expt>
/ blocks = [1-2 = example]
</expt>

<block example>
/ onblockbegin = [
    values.currentname = list.randomnames.nextvalue;
    values.currentage = list.randomages.nextvalue;
]
/ trials = [1-2 = exampletrial]
</block>

<trial exampletrial>
/ stimulusframes = [1=description]
/ validresponse = (57)
</trial>

<text description>
/ items = descriptionitems
/ select = sequence
</text>

<item descriptionitems>
/ 1 = "This is <%values.currentname%>."
/ 2 = "<%values.currentname%> is <%values.currentage%> years old."
</item>


Also see https://www.millisecond.com/forums/FindPost28411.aspx