Multiple response modes within trial


Author
Message
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: 108K
lukasg - 1/26/2022
Dave - 1/25/2022

No, you'll need two trials. An <openended> for the textbox response, followed by the shape selection <trial>.

When looking at the raw data file, the second response mode (textbox) creates a new row entry with another trial number. Since the first and second response are essentially the same trial, I was wondering whether it would be possible to append the row of the first trial instead?

Sure, store the response from the openended (textbox) in a value, set the openended's /recorddata attribute to false, log the value to the raw data file.
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/25/2022

No, you'll need two trials. An <openended> for the textbox response, followed by the shape selection <trial>.

When looking at the raw data file, the second response mode (textbox) creates a new row entry with another trial number. Since the first and second response are essentially the same trial, I was wondering whether it would be possible to append the row of the first trial instead?
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/25/2022

Here, these no longer make sense. Those aren't your response options anymore. You're now using objects called "shape1" to "shape8"

<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
   values.cresp = "1"
  } else if (values.t_color == #ff7f0e){
   values.cresp = "2"
  } else if (values.t_color == #2ca02c){
   values.cresp = "3"
  } else if (values.t_color == #d62728){
   values.cresp = "4"
  } else if (values.t_color == #9467bd){
   values.cresp = "5"
  } else if (values.t_color == #8c564b){
   values.cresp = "6"
  } else if (values.t_color == #e377c2){
   values.cresp = "7"
  } else if (values.t_color == #17becf){
   values.cresp = "8"
  };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)


</trial>

Thanks, surprisingly the branch worked with trial.colorResponse also. I tidied up the code and it is working now:

<openended trialPractice>
/ ontrialbegin = [
    
    // select digit items
    values.dig1 = list.digits.nextvalue;
    values.dig2 = list.digits.nextvalue;
// select target item
values.t = list.t_items.nextvalue;
// select distractor items
values.d1 = list.d_items.nextvalue;
values.d2 = list.d_items.nextvalue;
// select target position
values.t_x = list.t_x.nextvalue;
// select distractor positions
values.d1_x = list.d_x.nextvalue;
values.d2_x = list.d_x.nextvalue;
// select target color
values.t_color = list.t_colors.nextvalue;
// and corresponding response key

// combine digits
    values.correctdigit = concat(values.dig1, values.dig2);

//#1f77b4,        #ff7f0e, #2ca02c, #d62728, #9467bd, #8c564b, #e377c2, #17becf
//1 dark blue, 2 orange, 3 green, 4 red, 5 purple, 6 brown, 7 pink, 8 light blue

    
// select distractor colors
values.d1_color = list.d_colors.nextvalue;
values.d2_color = list.d_colors.nextvalue;
]

/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen;]
    
/ mask = positiveinteger
/ beginresponsetime = 350
/ correctresponse = (values.correctdigit)

/ branch = [if(openended.trialPractice.correct == 1 || openended.trialPractice.correct == 0)trial.colorResponse]

/ ontrialend = [
// reset relevant lists for next trial
list.d_items.reset();
list.d_x.reset();
list.d_colors.reset();
]

</openended>





<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
        values.cresp = "shape1"
    } else if (values.t_color == #ff7f0e){
        values.cresp = "shape2"
    } else if (values.t_color == #2ca02c){
        values.cresp = "shape3"
    } else if (values.t_color == #d62728){
        values.cresp = "shape4"
    } else if (values.t_color == #9467bd){
        values.cresp = "shape5"
    } else if (values.t_color == #8c564b){
        values.cresp = "shape6"
    } else if (values.t_color == #e377c2){
        values.cresp = "shape7"
    } else if (values.t_color == #17becf){
        values.cresp = "shape8"
    };
]

/stimulustimes = [0 = clearscreen; 650 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

</trial>




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: 108K
Dave - 1/25/2022
Dave - 1/25/2022
lukasg - 1/25/2022
Dave - 1/25/2022

Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

I have done so but I run into several issues with the code. 


<openended trialPractice>
/ ontrialbegin = [
    
    // combine digits
    values.correctdigit = concat(values.dig1, values.dig2);
    
    // select digit items
    values.dig1 = list.digits.nextvalue;
    values.dig2 = list.digits.nextvalue;
// select target item
values.t = list.t_items.nextvalue;
// select distractor items
values.d1 = list.d_items.nextvalue;
values.d2 = list.d_items.nextvalue;
// select target position
values.t_x = list.t_x.nextvalue;
// select distractor positions
values.d1_x = list.d_x.nextvalue;
values.d2_x = list.d_x.nextvalue;
// select target color
values.t_color = list.t_colors.nextvalue;
// and corresponding response key
    
// select distractor colors
values.d1_color = list.d_colors.nextvalue;
values.d2_color = list.d_colors.nextvalue;
]

/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)
// correctresponse = (values.cresp)
/ inputdevice = mouse
// validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]


/ ontrialend = [
// reset relevant lists for next trial
list.d_items.reset();
list.d_x.reset();
list.d_colors.reset();
]

</openended>


<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
        values.cresp = "1"
    } else if (values.t_color == #ff7f0e){
        values.cresp = "2"
    } else if (values.t_color == #2ca02c){
        values.cresp = "3"
    } else if (values.t_color == #d62728){
        values.cresp = "4"
    } else if (values.t_color == #9467bd){
        values.cresp = "5"
    } else if (values.t_color == #8c564b){
        values.cresp = "6"
    } else if (values.t_color == #e377c2){
        values.cresp = "7"
    } else if (values.t_color == #17becf){
        values.cresp = "8"
    };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

</trial>



<block practice>
/ trials = [1-5 = trialPractice]

/ correctmessage = true(correctmsg, 500)
/ errormessage = true(errormsg, 500)
</block>

Order matters. You're "combining" digits BEFORE you have selected digits in the given round. You need to combine them AFTER.

Here

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]

it's not a <trial> element. It's an <openended>.

Here, these no longer make sense. Those aren't your response options anymore. You're now using objects called "shape1" to "shape8"

<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
   values.cresp = "1"
  } else if (values.t_color == #ff7f0e){
   values.cresp = "2"
  } else if (values.t_color == #2ca02c){
   values.cresp = "3"
  } else if (values.t_color == #d62728){
   values.cresp = "4"
  } else if (values.t_color == #9467bd){
   values.cresp = "5"
  } else if (values.t_color == #8c564b){
   values.cresp = "6"
  } else if (values.t_color == #e377c2){
   values.cresp = "7"
  } else if (values.t_color == #17becf){
   values.cresp = "8"
  };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)


</trial>

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: 108K
Dave - 1/25/2022
lukasg - 1/25/2022
Dave - 1/25/2022

Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

I have done so but I run into several issues with the code. 


<openended trialPractice>
/ ontrialbegin = [
    
    // combine digits
    values.correctdigit = concat(values.dig1, values.dig2);
    
    // select digit items
    values.dig1 = list.digits.nextvalue;
    values.dig2 = list.digits.nextvalue;
// select target item
values.t = list.t_items.nextvalue;
// select distractor items
values.d1 = list.d_items.nextvalue;
values.d2 = list.d_items.nextvalue;
// select target position
values.t_x = list.t_x.nextvalue;
// select distractor positions
values.d1_x = list.d_x.nextvalue;
values.d2_x = list.d_x.nextvalue;
// select target color
values.t_color = list.t_colors.nextvalue;
// and corresponding response key
    
// select distractor colors
values.d1_color = list.d_colors.nextvalue;
values.d2_color = list.d_colors.nextvalue;
]

/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)
// correctresponse = (values.cresp)
/ inputdevice = mouse
// validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]


/ ontrialend = [
// reset relevant lists for next trial
list.d_items.reset();
list.d_x.reset();
list.d_colors.reset();
]

</openended>


<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
        values.cresp = "1"
    } else if (values.t_color == #ff7f0e){
        values.cresp = "2"
    } else if (values.t_color == #2ca02c){
        values.cresp = "3"
    } else if (values.t_color == #d62728){
        values.cresp = "4"
    } else if (values.t_color == #9467bd){
        values.cresp = "5"
    } else if (values.t_color == #8c564b){
        values.cresp = "6"
    } else if (values.t_color == #e377c2){
        values.cresp = "7"
    } else if (values.t_color == #17becf){
        values.cresp = "8"
    };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

</trial>



<block practice>
/ trials = [1-5 = trialPractice]

/ correctmessage = true(correctmsg, 500)
/ errormessage = true(errormsg, 500)
</block>

Order matters. You're "combining" digits BEFORE you have selected digits in the given round. You need to combine them AFTER.

Here

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]

it's not a <trial> element. It's an <openended>.
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: 108K
lukasg - 1/25/2022
Dave - 1/25/2022

Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

I have done so but I run into several issues with the code. 


<openended trialPractice>
/ ontrialbegin = [
    
    // combine digits
    values.correctdigit = concat(values.dig1, values.dig2);
    
    // select digit items
    values.dig1 = list.digits.nextvalue;
    values.dig2 = list.digits.nextvalue;
// select target item
values.t = list.t_items.nextvalue;
// select distractor items
values.d1 = list.d_items.nextvalue;
values.d2 = list.d_items.nextvalue;
// select target position
values.t_x = list.t_x.nextvalue;
// select distractor positions
values.d1_x = list.d_x.nextvalue;
values.d2_x = list.d_x.nextvalue;
// select target color
values.t_color = list.t_colors.nextvalue;
// and corresponding response key
    
// select distractor colors
values.d1_color = list.d_colors.nextvalue;
values.d2_color = list.d_colors.nextvalue;
]

/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)
// correctresponse = (values.cresp)
/ inputdevice = mouse
// validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]


/ ontrialend = [
// reset relevant lists for next trial
list.d_items.reset();
list.d_x.reset();
list.d_colors.reset();
]

</openended>


<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
        values.cresp = "1"
    } else if (values.t_color == #ff7f0e){
        values.cresp = "2"
    } else if (values.t_color == #2ca02c){
        values.cresp = "3"
    } else if (values.t_color == #d62728){
        values.cresp = "4"
    } else if (values.t_color == #9467bd){
        values.cresp = "5"
    } else if (values.t_color == #8c564b){
        values.cresp = "6"
    } else if (values.t_color == #e377c2){
        values.cresp = "7"
    } else if (values.t_color == #17becf){
        values.cresp = "8"
    };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

</trial>



<block practice>
/ trials = [1-5 = trialPractice]

/ correctmessage = true(correctmsg, 500)
/ errormessage = true(errormsg, 500)
</block>

Order matters. You're "combining" digits BEFORE you have selected digits in the given round. You need to combine them AFTER.
lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/25/2022

Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

I have done so but I run into several issues with the code. 


<openended trialPractice>
/ ontrialbegin = [
    
    // combine digits
    values.correctdigit = concat(values.dig1, values.dig2);
    
    // select digit items
    values.dig1 = list.digits.nextvalue;
    values.dig2 = list.digits.nextvalue;
// select target item
values.t = list.t_items.nextvalue;
// select distractor items
values.d1 = list.d_items.nextvalue;
values.d2 = list.d_items.nextvalue;
// select target position
values.t_x = list.t_x.nextvalue;
// select distractor positions
values.d1_x = list.d_x.nextvalue;
values.d2_x = list.d_x.nextvalue;
// select target color
values.t_color = list.t_colors.nextvalue;
// and corresponding response key
    
// select distractor colors
values.d1_color = list.d_colors.nextvalue;
values.d2_color = list.d_colors.nextvalue;
]

/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)
// correctresponse = (values.cresp)
/ inputdevice = mouse
// validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

/ branch = [if(trial.trialPractice.correct == 1 || trial.trialPractice.correct == 0)trial.colorResponse]


/ ontrialend = [
// reset relevant lists for next trial
list.d_items.reset();
list.d_x.reset();
list.d_colors.reset();
]

</openended>


<trial colorResponse>

/ ontrialbegin = [
if(values.t_color == #1f77b4){
        values.cresp = "1"
    } else if (values.t_color == #ff7f0e){
        values.cresp = "2"
    } else if (values.t_color == #2ca02c){
        values.cresp = "3"
    } else if (values.t_color == #d62728){
        values.cresp = "4"
    } else if (values.t_color == #9467bd){
        values.cresp = "5"
    } else if (values.t_color == #8c564b){
        values.cresp = "6"
    } else if (values.t_color == #e377c2){
        values.cresp = "7"
    } else if (values.t_color == #17becf){
        values.cresp = "8"
    };
]

/stimulustimes = [0 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
// validresponse = ("1", "2", "3", "4", "5", "6", "7", "8")
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)

</trial>



<block practice>
/ trials = [1-5 = trialPractice]

/ correctmessage = true(correctmsg, 500)
/ errormessage = true(errormsg, 500)
</block>

lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/25/2022

Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

Thanks again 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: 108K
lukasg - 1/25/2022
Dave - 1/25/2022

No, you'll need two trials. An <openended> for the textbox response, followed by the shape selection <trial>.

Thanks for your response. When trying to set this up, two follow-up questions arose:

a) Can the opendeded trial be followed by the 2nd response type automatically? The following code cannot be the way to do this:
<block 250ms>
/ trials = [1 = trial200; 2 = res2; 3 = trial200; 4 = res2; ...]
</block>


b) The correct response for the textbox should be a combination of the two presented digits. For instance, when 1 and 9 were presented I want the correct response to be 19. With the following code I have only managed to get both answer options to be correct, or the added value to the the correct response:

/ mask = positiveinteger
/ correctresponse = (values.dig1,values.dig2)

// OR

/ correctreponse = (valuesdig1 + values.dig2)



Re. a): You can /branch from the <openended> to the follow-up <trial>.
Re. b): You'll want to do

/ ontrialbegin = [values.correctanswer = concat(values.dig1, values.dig2);]

with

/ correctresponse = (values.correctanswer)

lukasg
lukasg
Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)Partner Member (633 reputation)
Group: Forum Members
Posts: 35, Visits: 103
Dave - 1/25/2022

No, you'll need two trials. An <openended> for the textbox response, followed by the shape selection <trial>.

Thanks for your response. When trying to set this up, two follow-up questions arose:

a) Can the opendeded trial be followed by the 2nd response type automatically? The following code cannot be the way to do this:
<block 250ms>
/ trials = [1 = trial200; 2 = res2; 3 = trial200; 4 = res2; ...]
</block>


b) The correct response for the textbox should be a combination of the two presented digits. For instance, when 1 and 9 were presented I want the correct response to be 19. With the following code I have only managed to get both answer options to be correct, or the added value to the the correct response:

/ mask = positiveinteger
/ correctresponse = (values.dig1,values.dig2)

// OR

/ correctreponse = (valuesdig1 + values.dig2)



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search