Millisecond Forums

Multiple response modes within trial

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

By lukasg - 1/25/2022

Hi All,

I am trying to combine a textbox response with a mouse-click response. For the former, participants should enter two earlier displayed digits (e.g., 7 and 9). For the latter, participants should press on one of several simultaneously presented shapes to indicate the colour of a target. A similar issue was raised in a previous forum post (https://www.millisecond.com/forums/Topic14994.aspx) from 8 years ago. Hence, I was wondering whether there would be a more straightforward way of doing so.

My current trial looks as follows:
/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)
</trial>


Now, I would like to add the textbox entry before the shape selection screen. Ideally, I would want to avoid switching to another trial. Is this possible?

All the best,
Lukas
By Dave - 1/25/2022

lukasg - 1/25/2022
Hi All,

I am trying to combine a textbox response with a mouse-click response. For the former, participants should enter two earlier displayed digits (e.g., 7 and 9). For the latter, participants should press on one of several simultaneously presented shapes to indicate the colour of a target. A similar issue was raised in a previous forum post (https://www.millisecond.com/forums/Topic14994.aspx) from 8 years ago. Hence, I was wondering whether there would be a more straightforward way of doing so.

My current trial looks as follows:
/stimulustimes = [0 = clearscreen; 1 = fixation; 150 = clearscreen; 151 = t, d1, d2 , dig1, dig2; 350 = clearscreen; 600 = shape1, shape2, shape3, shape4, shape5, shape6, shape7, shape8]
/ correctresponse = (values.cresp)
/ inputdevice = mouse
/ validresponse = (shape1,shape2,shape3,shape4,shape5,shape6,shape7,shape8)
</trial>


Now, I would like to add the textbox entry before the shape selection screen. Ideally, I would want to avoid switching to another trial. Is this possible?

All the best,
Lukas

No, you'll need two trials. An <openended> for the textbox response, followed by the shape selection <trial>.
By 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)


By Dave - 1/25/2022

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)
By 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)

Thanks again Dave!
By 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>
By 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.
By 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>.
By Dave - 1/25/2022

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>
By lukasg - 1/25/2022

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>



By 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?
By Dave - 1/26/2022

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.
By lukasg - 1/26/2022

Dave - 1/26/2022

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.

As always, much appreciated Dave. I do encounter an issue with the data though, and the data seem not to save to the corresponding trial. In the attached screenshot, no response is saved for the first trial which makes be think there is an offset ()?

<openended trial250>
/ 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);

// 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; 401 = clearscreen]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)

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

/ ontrialend = [
    // save data
    list.targetColor.appenditem(values.cresp);


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

</openended>





<trial colorResponse>

/ recorddata = false

/ 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; 1 = 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)


/ ontrialend = [
    values.colorResponse = trial.colorResponse.response;
    values.colorCorrect = trial.colorResponse.correct;
]

/ posttrialpause = 1000

</trial>




<data>

/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
script.sessionid, script.currentblock, script.currenttrialnumber,

values.t, values.t_x, values.t_color, values.colorResponse, values.cresp, values.colorCorrect, correct, latency, values.d1_color, values.d2_color, values.dig1, values.dig2, values.cresp, response

...


Where does my saving the trial information go wrong?
By Dave - 1/26/2022

lukasg - 1/26/2022
Dave - 1/26/2022

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.

As always, much appreciated Dave. I do encounter an issue with the data though, and the data seem not to save to the corresponding trial. In the attached screenshot, no response is saved for the first trial which makes be think there is an offset ()?

<openended trial250>
/ 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);

// 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; 401 = clearscreen]
    
/ mask = positiveinteger
/ beginresponsetime = 600
/ correctresponse = (values.correctdigit)

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

/ ontrialend = [
    // save data
    list.targetColor.appenditem(values.cresp);


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

</openended>





<trial colorResponse>

/ recorddata = false

/ 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; 1 = 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)


/ ontrialend = [
    values.colorResponse = trial.colorResponse.response;
    values.colorCorrect = trial.colorResponse.correct;
]

/ posttrialpause = 1000

</trial>




<data>

/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
script.sessionid, script.currentblock, script.currenttrialnumber,

values.t, values.t_x, values.t_color, values.colorResponse, values.cresp, values.colorCorrect, correct, latency, values.d1_color, values.d2_color, values.dig1, values.dig2, values.cresp, response

...


Where does my saving the trial information go wrong?

You're doing things the wrong way around. The openended *precedes* the color response trial. The openended can't look into the future and log information it cannot possibly know yet.
By lukasg - 1/26/2022

Dave - 1/26/2022

You're doing things the wrong way around. The openended *precedes* the color response trial. The openended can't look into the future and log information it cannot possibly know yet.

Meaning rather than saving values of the 2nd trial, I need to save those of the 1st (250 ms) trial? Unfortunately, most values of the 250ms trial are relevant whereas I am only interested in the response during the 2nd trial.
By Dave - 1/26/2022

lukasg - 1/26/2022
Dave - 1/26/2022

You're doing things the wrong way around. The openended *precedes* the color response trial. The openended can't look into the future and log information it cannot possibly know yet.

Meaning rather than saving values of the 2nd trial, I need to save those of the 1st (250 ms) trial? Unfortunately, most values of the 250ms trial are relevant whereas I am only interested in the response during the 2nd trial.

> Unfortunately, most values of the 250ms trial are relevant whereas I am only interested in the response during the 2nd trial.

They'll still be logged, so I don't know why you think this would be a problem.
By lukasg - 1/26/2022

Dave - 1/26/2022

> Unfortunately, most values of the 250ms trial are relevant whereas I am only interested in the response during the 2nd trial.

They'll still be logged, so I don't know why you think this would be a problem.

I was under the impression that, similar to what I did before, I would need to save all information in separate 'values'. I suppose the values are logged and overwritten once the next 250ms trial begins? Switching the order solved the issue 
By Dave - 1/26/2022

lukasg - 1/26/2022
Dave - 1/26/2022

> Unfortunately, most values of the 250ms trial are relevant whereas I am only interested in the response during the 2nd trial.

They'll still be logged, so I don't know why you think this would be a problem.

I was under the impression that, similar to what I did before, I would need to save all information in separate 'values'. I suppose the values are logged and overwritten once the next 250ms trial begins? Switching the order solved the issue 

In Inquisit parlance, a "value" is what you know as a variable* in other programming languages. A variable keeps the value you assign to until you change it. You assign values to your variables at the start of each instance of <openended trial250>. <trial colorResponse> changes nothing in these variables, so when that trial writes a line to the data file, the values as set in the preceding openended are captured.

*<variables> used to be a diferent syntax construct from early on in Inquisit's history, so the proper moniker was already taken; unfortunate in hindsight.
By lukasg - 1/26/2022

Dave - 1/26/2022

In Inquisit parlance, a "value" is what you know as a variable* in other programming languages. A variable keeps the value you assign to until you change it. You assign values to your variables at the start of each instance of <openended trial250>. <trial colorResponse> changes nothing in these variables, so when that trial writes a line to the data file, the values as set in the preceding openended are captured.

*<variables> used to be a diferent syntax construct from early on in Inquisit's history, so the proper moniker was already taken; unfortunate in hindsight.

However, what about variables such as latency. This is overwritten upon the start of the second trial. How would I go about importing the latency of the 1st trial, without specifying a new column for each type of 1st trial (because the first trial will vary on presentation times). I would want to avoid the following:


<data>
/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, blockcode, blocknum, trialcode, trialnum,blockcode

values.t, values.t_x, values.t_color, openended.trial250.response, openended.trial250.cresp, values.colorResponse, values.colorCorrect, openended.trial250.latency, openended.trial200.latency, ..

By Dave - 1/26/2022

lukasg - 1/26/2022
Dave - 1/26/2022

In Inquisit parlance, a "value" is what you know as a variable* in other programming languages. A variable keeps the value you assign to until you change it. You assign values to your variables at the start of each instance of <openended trial250>. <trial colorResponse> changes nothing in these variables, so when that trial writes a line to the data file, the values as set in the preceding openended are captured.

*<variables> used to be a diferent syntax construct from early on in Inquisit's history, so the proper moniker was already taken; unfortunate in hindsight.

However, what about variables such as latency. This is overwritten upon the start of the second trial. How would I go about importing the latency of the 1st trial, without specifying a new column for each type of 1st trial (because the first trial will vary on presentation times). I would want to avoid the following:


<data>
/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, blockcode, blocknum, trialcode, trialnum,blockcode

values.t, values.t_x, values.t_color, openended.trial250.response, openended.trial250.cresp, values.colorResponse, values.colorCorrect, openended.trial250.latency, openended.trial200.latency, ..


All you need is a variable (value) and then have all openended elements store their latency in that variable. Log that variable.
By lukasg - 1/26/2022

lukasg - 1/26/2022

However, what about variables such as latency. This is overwritten upon the start of the second trial. How would I go about importing the latency of the 1st trial, without specifying a new column for each type of 1st trial (because the first trial will vary on presentation times). I would want to avoid the following:


<data>
/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, blockcode, blocknum, trialcode, trialnum,blockcode

values.t, values.t_x, values.t_color, openended.trial250.response, openended.trial250.cresp, values.colorResponse, values.colorCorrect, openended.trial250.latency, openended.trial200.latency, ..


I am sure there are better ways to do this. For now, I figured updating some value (e.g., value.latency) on the end of each 1st trial type will get the job done. For instance:


/ ontrialend = [    
    values.latency = openended.trial250.latency;
    ]

/ ontrialend = [    
    values.latency = openended.trial200.latency;
    ]
    


And so on...
By lukasg - 1/26/2022

Dave - 1/26/2022
lukasg - 1/26/2022
Dave - 1/26/2022

In Inquisit parlance, a "value" is what you know as a variable* in other programming languages. A variable keeps the value you assign to until you change it. You assign values to your variables at the start of each instance of <openended trial250>. <trial colorResponse> changes nothing in these variables, so when that trial writes a line to the data file, the values as set in the preceding openended are captured.

*<variables> used to be a diferent syntax construct from early on in Inquisit's history, so the proper moniker was already taken; unfortunate in hindsight.

However, what about variables such as latency. This is overwritten upon the start of the second trial. How would I go about importing the latency of the 1st trial, without specifying a new column for each type of 1st trial (because the first trial will vary on presentation times). I would want to avoid the following:


<data>
/ columns = (build, computer.platform, computer.timerresolution, expressions.canvasRatio, date, time, subject, blockcode, blocknum, trialcode, trialnum,blockcode

values.t, values.t_x, values.t_color, openended.trial250.response, openended.trial250.cresp, values.colorResponse, values.colorCorrect, openended.trial250.latency, openended.trial200.latency, ..


All you need is a variable (value) and then have all openended elements store their latency in that variable. Log that variable.

Great, this is what I ended up doing. Thanks.