Set stimulus items dynamically by assigning an element


Author
Message
dschulz
dschulz
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 7, Visits: 17
Dear Community,

I am struggling with an implementation, and I am yet to find a solution by myself or in this forum. I want to assign different items to a stimulus element (sound and picture) depending on earlier selections (the participants have to enter their language and gender by dropdown). I would love to do this via an expression, but have not yet found a satisfying solution. Creating an empty <item> and filling it with .appenditem is not an option since this would be to much code.
I created a mock experiment to visualize, what I want to do. Maybe someone has a clean solution. The crucial part is the / ontrialend expression in the select-<trial>

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>

<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.continue.items = item.a;
    } else if (trial.select.response == 48) {
        text.continue.items = item.b;
    } else {
        text.continue.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Thank you in advance. Best,
Daniel


dschulz
dschulz
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 7, Visits: 17
dschulz - 6/17/2020
Dear Community,

I am struggling with an implementation, and I am yet to find a solution by myself or in this forum. I want to assign different items to a stimulus element (sound and picture) depending on earlier selections (the participants have to enter their language and gender by dropdown). I would love to do this via an expression, but have not yet found a satisfying solution. Creating an empty <item> and filling it with .appenditem is not an option since this would be to much code.
I created a mock experiment to visualize, what I want to do. Maybe someone has a clean solution. The crucial part is the / ontrialend expression in the select-<trial>

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>

<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.continue.items = item.a;
    } else if (trial.select.response == 48) {
        text.continue.items = item.b;
    } else {
        text.continue.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Thank you in advance. Best,
Daniel


This would be the correct code. Got text.continue and text.dynamical confused.

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>


<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.dynamical.appenditem(item.a.1);
    } else if (trial.select.response == 48) {
        text.dynamical.items = item.b;
    } else {
        text.dynamical.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Dave
Dave
Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)
Group: Administrators
Posts: 10K, Visits: 58K
dschulz - 6/17/2020
Dear Community,

I am struggling with an implementation, and I am yet to find a solution by myself or in this forum. I want to assign different items to a stimulus element (sound and picture) depending on earlier selections (the participants have to enter their language and gender by dropdown). I would love to do this via an expression, but have not yet found a satisfying solution. Creating an empty <item> and filling it with .appenditem is not an option since this would be to much code.
I created a mock experiment to visualize, what I want to do. Maybe someone has a clean solution. The crucial part is the / ontrialend expression in the select-<trial>

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>

<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.continue.items = item.a;
    } else if (trial.select.response == 48) {
        text.continue.items = item.b;
    } else {
        text.continue.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Thank you in advance. Best,
Daniel


Take a look at the multi-language IAT script here:
https://www.millisecond.com/download/library/v5/iat/iattemplates/multilanguageiat/iat_multilanguage.iqzip
dschulz
dschulz
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 7, Visits: 17
Dave - 6/17/2020
dschulz - 6/17/2020
Dear Community,

I am struggling with an implementation, and I am yet to find a solution by myself or in this forum. I want to assign different items to a stimulus element (sound and picture) depending on earlier selections (the participants have to enter their language and gender by dropdown). I would love to do this via an expression, but have not yet found a satisfying solution. Creating an empty <item> and filling it with .appenditem is not an option since this would be to much code.
I created a mock experiment to visualize, what I want to do. Maybe someone has a clean solution. The crucial part is the / ontrialend expression in the select-<trial>

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>

<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.continue.items = item.a;
    } else if (trial.select.response == 48) {
        text.continue.items = item.b;
    } else {
        text.continue.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Thank you in advance. Best,
Daniel


Take a look at the multi-language IAT script here:
https://www.millisecond.com/download/library/v5/iat/iattemplates/multilanguageiat/iat_multilanguage.iqzip

Thanks Dave,

I considered this, but since the script I'm working with was written by someone else who already did a lot of work which I just wanted to optimize, this is sadly not a viable (in terms of time investment) solution.

So there is no way to dynamically assign an <item> element to the / items attribute of a stimulus?

Thank you anyways. Best,
Daniel
Dave
Dave
Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)Supreme Being (830K reputation)
Group: Administrators
Posts: 10K, Visits: 58K
dschulz - 6/18/2020
Dave - 6/17/2020
dschulz - 6/17/2020
Dear Community,

I am struggling with an implementation, and I am yet to find a solution by myself or in this forum. I want to assign different items to a stimulus element (sound and picture) depending on earlier selections (the participants have to enter their language and gender by dropdown). I would love to do this via an expression, but have not yet found a satisfying solution. Creating an empty <item> and filling it with .appenditem is not an option since this would be to much code.
I created a mock experiment to visualize, what I want to do. Maybe someone has a clean solution. The crucial part is the / ontrialend expression in the select-<trial>

<defaults>
/ inputdevice = keyboard
</defaults>

<item a>
/ 1 = "first"
/ 2 = "choice"
</item>

<item b>
/ 1 = "second"
/ 2 = "select"
</item>

<text instruction>
/ items = ("Press 'a' for the first items, press 'b' for the second items")
</text>

<trial select>
/ stimulusframes = [1 = instruction]
/ correctresponse = (30, 48)
/ ontrialend = [
    if (trial.select.response == 30) {
        text.continue.items = item.a;
    } else if (trial.select.response == 48) {
        text.continue.items = item.b;
    } else {
        text.continue.items = "ERROR";
    }
]
</trial>

<text dynamical>
/ select = sequence
</text>

<text continue>
/ items = ("Press SPACE to continue")
/ vposition = 80%
</text>


<trial showtext>
/ stimulusframes = [1 = dynamical; 2 = continue]
/ validresponse = (57)
</trial>

<block showblock>
/ trials = [1 = select; 2-3 = showtext]
</block>


Thank you in advance. Best,
Daniel


Take a look at the multi-language IAT script here:
https://www.millisecond.com/download/library/v5/iat/iattemplates/multilanguageiat/iat_multilanguage.iqzip

Thanks Dave,

I considered this, but since the script I'm working with was written by someone else who already did a lot of work which I just wanted to optimize, this is sadly not a viable (in terms of time investment) solution.

So there is no way to dynamically assign an <item> element to the / items attribute of a stimulus?

Thank you anyways. Best,
Daniel

> So there is no way to dynamically assign an <item> element to the / items attribute of a stimulus?

There isn't, but there are lots of ways to achieve the same thing. One of which is illustrated in the IAT script I linked.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search