Coding multiple correct responses


Author
Message
bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

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: 12K, Visits: 98K
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

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: 12K, Visits: 98K
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Also, your task description is underspecified. What's supposed to happen if they don't select all letters? What's supposed to happen if they select a non-letter character? What's supposed to happen if they click the same letter or non-letter character multiple times? Is the order of the on-screen items always supposed to be LETTER-LETTER-LETTER-NONLETTER or is that supposed to vary or be randomized? What about the ratio of letters to nonletters? Always 3 to 1, does it vary? etc.

Edited 3 Years Ago by Dave
bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!
bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>
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: 12K, Visits: 98K
bowenwang6266 - 2/28/2021
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>

You'll have to do something like this, then:

<values>
/ responses = ""
/ correct = 0
/ timeleft = 5000
</values>

<block exampleblock>
/ trials = [1=start]
</block>

<trial start>
/ ontrialbegin = [
    values.responses= "";
    values.correct = 0;
    values.timeleft = 5000;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 1000
/ branch = [
    trial.clicktrial;
]
/ recorddata = false
</trial>

<trial clicktrial>
/ ontrialend = [
    values.responses = concat(concat(values.responses, "|"), trial.clicktrial.response);
    values.timeleft -= trial.clicktrial.latency;
    ]
/ stimulusframes = [1=clearscreen, letter1, letter2, letter3, symbol1]
/ inputdevice = mouse
/ validresponse = (letter1, letter2, letter3, symbol1)
/ correctresponse = (letter1, letter2, letter3)
/ timeout = values.timeleft
/ branch = [
    if (trial.clicktrial.response != 0) {
        trial.clicktrial;
    } else trial.score;
]
/ recorddata = false
</trial>

<trial score>
/ ontrialbegin = [
    if (contains(values.responses, "letter1") && contains(values.responses, "letter2") && contains(values.responses, "letter3") && !contains(values.responses, "symbol1")){
        values.correct = 1;
    } else {
        values.correct = 0;
    }
]
/ trialduration = 0
</trial>


<text letter1>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter2>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter3>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text symbol1>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.responses values.correct)
</data>

bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
Dave - 3/1/2021
bowenwang6266 - 2/28/2021
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>

You'll have to do something like this, then:

<values>
/ responses = ""
/ correct = 0
/ timeleft = 5000
</values>

<block exampleblock>
/ trials = [1=start]
</block>

<trial start>
/ ontrialbegin = [
    values.responses= "";
    values.correct = 0;
    values.timeleft = 5000;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 1000
/ branch = [
    trial.clicktrial;
]
/ recorddata = false
</trial>

<trial clicktrial>
/ ontrialend = [
    values.responses = concat(concat(values.responses, "|"), trial.clicktrial.response);
    values.timeleft -= trial.clicktrial.latency;
    ]
/ stimulusframes = [1=clearscreen, letter1, letter2, letter3, symbol1]
/ inputdevice = mouse
/ validresponse = (letter1, letter2, letter3, symbol1)
/ correctresponse = (letter1, letter2, letter3)
/ timeout = values.timeleft
/ branch = [
    if (trial.clicktrial.response != 0) {
        trial.clicktrial;
    } else trial.score;
]
/ recorddata = false
</trial>

<trial score>
/ ontrialbegin = [
    if (contains(values.responses, "letter1") && contains(values.responses, "letter2") && contains(values.responses, "letter3") && !contains(values.responses, "symbol1")){
        values.correct = 1;
    } else {
        values.correct = 0;
    }
]
/ trialduration = 0
</trial>


<text letter1>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter2>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter3>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text symbol1>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.responses values.correct)
</data>

Thank you SO much for your help, Dave! This is super helpful!
bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
Dave - 3/1/2021
bowenwang6266 - 2/28/2021
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>

You'll have to do something like this, then:

<values>
/ responses = ""
/ correct = 0
/ timeleft = 5000
</values>

<block exampleblock>
/ trials = [1=start]
</block>

<trial start>
/ ontrialbegin = [
    values.responses= "";
    values.correct = 0;
    values.timeleft = 5000;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 1000
/ branch = [
    trial.clicktrial;
]
/ recorddata = false
</trial>

<trial clicktrial>
/ ontrialend = [
    values.responses = concat(concat(values.responses, "|"), trial.clicktrial.response);
    values.timeleft -= trial.clicktrial.latency;
    ]
/ stimulusframes = [1=clearscreen, letter1, letter2, letter3, symbol1]
/ inputdevice = mouse
/ validresponse = (letter1, letter2, letter3, symbol1)
/ correctresponse = (letter1, letter2, letter3)
/ timeout = values.timeleft
/ branch = [
    if (trial.clicktrial.response != 0) {
        trial.clicktrial;
    } else trial.score;
]
/ recorddata = false
</trial>

<trial score>
/ ontrialbegin = [
    if (contains(values.responses, "letter1") && contains(values.responses, "letter2") && contains(values.responses, "letter3") && !contains(values.responses, "symbol1")){
        values.correct = 1;
    } else {
        values.correct = 0;
    }
]
/ trialduration = 0
</trial>


<text letter1>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter2>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter3>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text symbol1>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.responses values.correct)
</data>

Hi Dave,

I have a follow-up question. Is it possible to record the latency of clicking each letter/symbol?

Thank you very much again!
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: 12K, Visits: 98K
bowenwang6266 - 3/6/2021
Dave - 3/1/2021
bowenwang6266 - 2/28/2021
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>

You'll have to do something like this, then:

<values>
/ responses = ""
/ correct = 0
/ timeleft = 5000
</values>

<block exampleblock>
/ trials = [1=start]
</block>

<trial start>
/ ontrialbegin = [
    values.responses= "";
    values.correct = 0;
    values.timeleft = 5000;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 1000
/ branch = [
    trial.clicktrial;
]
/ recorddata = false
</trial>

<trial clicktrial>
/ ontrialend = [
    values.responses = concat(concat(values.responses, "|"), trial.clicktrial.response);
    values.timeleft -= trial.clicktrial.latency;
    ]
/ stimulusframes = [1=clearscreen, letter1, letter2, letter3, symbol1]
/ inputdevice = mouse
/ validresponse = (letter1, letter2, letter3, symbol1)
/ correctresponse = (letter1, letter2, letter3)
/ timeout = values.timeleft
/ branch = [
    if (trial.clicktrial.response != 0) {
        trial.clicktrial;
    } else trial.score;
]
/ recorddata = false
</trial>

<trial score>
/ ontrialbegin = [
    if (contains(values.responses, "letter1") && contains(values.responses, "letter2") && contains(values.responses, "letter3") && !contains(values.responses, "symbol1")){
        values.correct = 1;
    } else {
        values.correct = 0;
    }
]
/ trialduration = 0
</trial>


<text letter1>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter2>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter3>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text symbol1>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.responses values.correct)
</data>

Hi Dave,

I have a follow-up question. Is it possible to record the latency of clicking each letter/symbol?

Thank you very much again!

Yeah, you can set /recorddata = true in <trial clicktrial> and that should give you that.
bowenwang6266
bowenwang6266
Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)Associate Member (72 reputation)
Group: Forum Members
Posts: 6, Visits: 32
Dave - 3/8/2021
bowenwang6266 - 3/6/2021
Dave - 3/1/2021
bowenwang6266 - 2/28/2021
bowenwang6266 - 2/27/2021
Dave - 2/25/2021
bowenwang6266 - 2/25/2021
In a task I'm trying to code, the respondents need to touch/click each of the letters in the options. For instance, when I present them with four options on the screen ("k", "t", "l", "?"), they will need to touch/click each of the letters ("k", "t", and "l"). I know how to code single-answer questions but I'm not sure how to code this. Following is the codes I have so far. Thank you very much in advance for your help!

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
...

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

Please provide code that's sufficiently complete to actually run. Apart from that, see e.g. https://www.millisecond.com/forums/FindPost27364.aspx

Hi Dave,

Thank you so much for your reply! Yes, I did see that post before I posted my questions. I tried to adapt the codes you provided for that question but did not succeed. I'm very new to Inquisit so your help will be much appreciated.

For scoring, if the respondent selects any non-letters/doesn’t select all letters (within five seconds) then they will be scored as 0 on that question. Selecting all the letters will be scored as 1. Multiple clicks are allowed. 

Here are all the stimuli: gkj3, TIKL&, sjby, vqu#ap, rh!nv, QK&G, CBT?SI, L3VHJ. So neither the length nor the letter-symbol ratio is fixed. (So I assume I'll need to code each item separately?)

Following is my codes for the first item, I have trouble finishing coding the rest of the <trial>

<text choice1_example1p>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice2_example1p>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice3_example1p>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<text choice4_example1p>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = true(white)
</text>

<trial example1p>
/ stimulustimes = [1000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 1000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ response = timeout(5000)
... (I cannot figure out how to code the rest)

<block exampletask1p>
/ trials = [1 = example1p]
</block>

<expt>
/ blocks = [
    1 = exampleinsp
]
</expt>

Thank you so much for your help!

I did try to mimic that post and code the rest of the trial but it does not work:

<trial example1p>
/ inputdevice = mouse
/ ontrialbegin = [values.first_touch=0; values.first_touch_latency=0;
  values.second_touch=0; values.second_touch_latency = 0]
/ stimulustimes = [1000 = fixation; 2000 = choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ validresponse = (choice1_example1p, choice2_example1p, choice3_example1p, choice4_example1p)
/ isvalidresponse = [if(values.first_touch==0) {
  values.first_touch=trial.example1p.response;
  values.first_touch_latency=trial.example1p.latency;
  false; };
  if (values.first_touch != 0 && trial.example1p.latency>values.first_touch_latency) {
  values.second_touch=trial.example1p.response;
  values.second_touch_latency = trial.example1p.latency;
  false; };
  values.first_touch != 0 && values.second_touch != 0]
/ iscorrectresponse = [trial.example1p.response==choice1_example1p) && contains(choice2_example1p)]
/ response = timeout(5000)

<values>
/ total_correct = 0
/ first_touch = 0
/ first_touch_latency = 0
/ second_touch = 0
/ second_touch_latency = 0
</values>

You'll have to do something like this, then:

<values>
/ responses = ""
/ correct = 0
/ timeleft = 5000
</values>

<block exampleblock>
/ trials = [1=start]
</block>

<trial start>
/ ontrialbegin = [
    values.responses= "";
    values.correct = 0;
    values.timeleft = 5000;
]
/ stimulusframes = [1=clearscreen]
/ trialduration = 1000
/ branch = [
    trial.clicktrial;
]
/ recorddata = false
</trial>

<trial clicktrial>
/ ontrialend = [
    values.responses = concat(concat(values.responses, "|"), trial.clicktrial.response);
    values.timeleft -= trial.clicktrial.latency;
    ]
/ stimulusframes = [1=clearscreen, letter1, letter2, letter3, symbol1]
/ inputdevice = mouse
/ validresponse = (letter1, letter2, letter3, symbol1)
/ correctresponse = (letter1, letter2, letter3)
/ timeout = values.timeleft
/ branch = [
    if (trial.clicktrial.response != 0) {
        trial.clicktrial;
    } else trial.score;
]
/ recorddata = false
</trial>

<trial score>
/ ontrialbegin = [
    if (contains(values.responses, "letter1") && contains(values.responses, "letter2") && contains(values.responses, "letter3") && !contains(values.responses, "symbol1")){
        values.correct = 1;
    } else {
        values.correct = 0;
    }
]
/ trialduration = 0
</trial>


<text letter1>
/ items = ("g")
/ position = (12.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter2>
/ items = ("k")
/ position = (37.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text letter3>
/ items = ("j")
/ position = (62.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<text symbol1>
/ items = ("3")
/ position = (87.5%, 50%)
/ size = (23%, 16%)
/ txbgcolor = yellow
/ txcolor = black
/ fontstyle = ("Arial", 15%, false, false, false, false, 5, 1)
/ erase = false
</text>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.responses values.correct)
</data>

Hi Dave,

I have a follow-up question. Is it possible to record the latency of clicking each letter/symbol?

Thank you very much again!

Yeah, you can set /recorddata = true in <trial clicktrial> and that should give you that.

Thank you so much!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search