Millisecond Forums

conditional valid response

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

By troyh - 5/24/2021

Hello,
How can I make a trial's valid response contingent on which picture is randomly selected to display for that trial?
I have tried this:

<trial encoding>
/ ontrialbegin = [
    if(list.pics.items == picture.doors) values.responsekey = 2 || 3 else values.responsekey = 9 || 10;
]
/ stimulusframes = [1=list.pics; 2=scancode]
/ isvalidresponse = [
    trial.encoding.response == values.responsekey
]
</trial>

but nothing registers as a response in the trial

and I tried to attach a zip (never sure if this works, sometimes it seems like it does, other times not).
By Dave - 5/24/2021

troyh - 5/24/2021
Hello,
How can I make a trial's valid response contingent on which picture is randomly selected to display for that trial?
I have tried this:

<trial encoding>
/ ontrialbegin = [
    if(list.pics.items == picture.doors) values.responsekey = 2 || 3 else values.responsekey = 9 || 10;
]
/ stimulusframes = [1=list.pics; 2=scancode]
/ isvalidresponse = [
    trial.encoding.response == values.responsekey
]
</trial>

but nothing registers as a response in the trial

and I tried to attach a zip (never sure if this works, sometimes it seems like it does, other times not).

if(list.pics.items == picture.doors)

This does not return anything -- and it's unclear from the snippet what it's supposed to do in the first place -- so this condition never evaluates to true and no response keys are ever set, and this 

values.responsekey = 2 || 3 else values.responsekey = 9 || 10;

simply is not valid syntax at all. A variable (values.responsekey) cannot hold two values at once.
By troyh - 5/24/2021

Dave - 5/25/2021
troyh - 5/24/2021
Hello,
How can I make a trial's valid response contingent on which picture is randomly selected to display for that trial?
I have tried this:

<trial encoding>
/ ontrialbegin = [
    if(list.pics.items == picture.doors) values.responsekey = 2 || 3 else values.responsekey = 9 || 10;
]
/ stimulusframes = [1=list.pics; 2=scancode]
/ isvalidresponse = [
    trial.encoding.response == values.responsekey
]
</trial>

but nothing registers as a response in the trial

and I tried to attach a zip (never sure if this works, sometimes it seems like it does, other times not).

if(list.pics.items == picture.doors)

This does not return anything -- and it's unclear from the snippet what it's supposed to do in the first place -- so this condition never evaluates to true and no response keys are ever set.

I was hoping for if(list.pics.items == picture.doors) to mean
"if any picture from my list of pictures in picture.doors is selected" , then the valid response is 2 or 3, and 

if any picture from my list of pictures in picture.faces is selected, then the valid response is 9 or 10
By Dave - 5/24/2021

troyh - 5/25/2021
Dave - 5/25/2021
troyh - 5/24/2021
Hello,
How can I make a trial's valid response contingent on which picture is randomly selected to display for that trial?
I have tried this:

<trial encoding>
/ ontrialbegin = [
    if(list.pics.items == picture.doors) values.responsekey = 2 || 3 else values.responsekey = 9 || 10;
]
/ stimulusframes = [1=list.pics; 2=scancode]
/ isvalidresponse = [
    trial.encoding.response == values.responsekey
]
</trial>

but nothing registers as a response in the trial

and I tried to attach a zip (never sure if this works, sometimes it seems like it does, other times not).

if(list.pics.items == picture.doors)

This does not return anything -- and it's unclear from the snippet what it's supposed to do in the first place -- so this condition never evaluates to true and no response keys are ever set.

I was hoping for if(list.pics.items == picture.doors) to mean
"if any picture from my list of pictures in picture.doors is selected" , then the valid response is 2 or 3, and 

if any picture from my list of pictures in picture.faces is selected, then the valid response is 9 or 10

Here's an example that you should be able to adapt:

<values>
/ key_1 = ""
/ key_2 = ""
</values>

<text odd>
/ items = ("1", "3", "5", "7")
</text>

<text even>
/ items = ("2", "4", "6", "8")
</text>

<list stimuli>
/ items = (text.odd, text.even)
/ poolsize = 8
</list>

// if stimulus is odd, valid responses are 1 & 3
// if stimulus is even, valid responses are 2 & 4
<trial example>
/ ontrialbegin = [
    if (list.stimuli.nextvalue == text.odd){
        values.key_1 = "1";
        values.key_2 = "3";
    } else {
        values.key_1 = "2";
        values.key_2 = "4";
    }
]
/ stimulustimes = [1=list.stimuli]
/ validresponse = (values.key_1, values.key_2)
</trial>

<block exammpleblock>
/ trials = [1-8 = trial.example]
</block>
By troyh - 5/24/2021

Dave - 5/25/2021
troyh - 5/25/2021
Dave - 5/25/2021
troyh - 5/24/2021
Hello,
How can I make a trial's valid response contingent on which picture is randomly selected to display for that trial?
I have tried this:

<trial encoding>
/ ontrialbegin = [
    if(list.pics.items == picture.doors) values.responsekey = 2 || 3 else values.responsekey = 9 || 10;
]
/ stimulusframes = [1=list.pics; 2=scancode]
/ isvalidresponse = [
    trial.encoding.response == values.responsekey
]
</trial>

but nothing registers as a response in the trial

and I tried to attach a zip (never sure if this works, sometimes it seems like it does, other times not).

if(list.pics.items == picture.doors)

This does not return anything -- and it's unclear from the snippet what it's supposed to do in the first place -- so this condition never evaluates to true and no response keys are ever set.

I was hoping for if(list.pics.items == picture.doors) to mean
"if any picture from my list of pictures in picture.doors is selected" , then the valid response is 2 or 3, and 

if any picture from my list of pictures in picture.faces is selected, then the valid response is 9 or 10

Here's an example that you should be able to adapt:

<values>
/ key_1 = ""
/ key_2 = ""
</values>

<text odd>
/ items = ("1", "3", "5", "7")
</text>

<text even>
/ items = ("2", "4", "6", "8")
</text>

<list stimuli>
/ items = (text.odd, text.even)
/ poolsize = 8
</list>

// if stimulus is odd, valid responses are 1 & 3
// if stimulus is even, valid responses are 2 & 4
<trial example>
/ ontrialbegin = [
    if (list.stimuli.nextvalue == text.odd){
        values.key_1 = "1";
        values.key_2 = "3";
    } else {
        values.key_1 = "2";
        values.key_2 = "4";
    }
]
/ stimulustimes = [1=list.stimuli]
/ validresponse = (values.key_1, values.key_2)
</trial>

<block exammpleblock>
/ trials = [1-8 = trial.example]
</block>

I've literally been struggling with this single problem the past 4 hours and it took 2 mins to adapt it with your response. Thanks so much.