Multiple correct responses


Author
Message
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
clarkm - 10/12/2020
Hi all!

I am creating a simple experiment where participants see a picture of an object, followed by a sound, and must respond with two simultaneous key presses. When participants respond, it should immediately go on to the next trial. The following code does that, which is great. However, I would like it so that pressing just ONE key (either 34 or 38) is recorded as an incorrect response. Currently, pressing just one key does nothing and Inquisit waits for a second key press before moving onto the next trial. 

I am assuming the problem lies somewhere in the <trial> element (see below). Anyone have any ideas? 

Thank you all in advance :-)


<trial power_low>
/ inputdevice = keyboard
/ ontrialbegin = [list.bigstims.nextvalue]
/ ontrialbegin = [values.Grip = "WHG"; values.Tone = "low"]
/ ontrialbegin = [values.first_key=0; values.first_key_latency=0;
  values.second_key=0; values.second_key_latency = 0;
  values.correctkeys = "34, 38"; ]
/ stimulustimes = [1 = big_objects; 2000 = sound.low]
/ validresponse = (34, 38)
/ isvalidresponse = [if(values.first_key==0) {
  values.first_key=trial.power_low.response;
  values.first_key_latency=trial.power_low.latency;
  false; };
  if (values.first_key != 0 && trial.power_low.latency>values.first_key_latency) {
  values.second_key=trial.power_low.response;
  values.second_key_latency = trial.power_low.latency;
  false; };
  values.first_key != 0 && values.second_key != 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)
                        && (values.first_key != values.second_key)]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ recorddata = true
/ timeout = (7000)
/ branch = [if (trial.power_low.error) trial.errorfb]
/ branch = [if (trial.power_low.correct) trial.correctfb]
</trial>

The trial will wait for a 2nd response for the duration of the timeout. If no such response occurs, it'll move on to the next. That's how the trial is set up. If you want to reduce the amount of time the participant has to submit the two responses, reduce the timeout. Inquisit has no way of knowing whether a participant still *will* press the 2nd key after they've pressed the first.

Key presses will virtually never happen at exactly the same time, so: Inquisit *has* to wait for the 2nd key press (and will do so for the duration of the timeout). If you were to terminate the trial after detecting a single key press, you would never even have the chance to catch the 2nd key press. Now, if for the purpose of scoring responses as correct / incorrect, you wish to check that the key presses are no more than X milliseconds apart, you can do that via /iscorrectresponse.

<values>
/ first_key = 0
/ second_key = 0
/ first_key_latency = 0
/ second_key_latency = 0
/ correctkeys = ""
</values>


<trial power_low>
/ inputdevice = keyboard
/ ontrialbegin = [values.first_key=0; values.first_key_latency=0;
values.second_key=0; values.second_key_latency = 0;
values.correctkeys = "34, 38"; ]
/ stimulustimes = [1 = wait; 2000 = respond]
/ validresponse = (34, 38)
/ isvalidresponse = [if(values.first_key==0 && trial.power_low.response > 0) {
values.first_key=trial.power_low.response;
values.first_key_latency=trial.power_low.latency;
false; };
if (values.first_key > 0 && trial.power_low.response > 0 && trial.power_low.latency>values.first_key_latency) {
values.second_key=trial.power_low.response;
values.second_key_latency = trial.power_low.latency;
false; };
values.first_key > 0 && values.second_key > 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)
        && (values.first_key != values.second_key) && abs(values.second_key_latency-values.first_key_latency)<100]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ recorddata = true
/ timeout = 7000
</trial>

<text wait>
/ items = ("wait...")
</text>

<text respond>
/ items = ("NOW RESPOND")
</text>

<block myblock>
/ trials = [1-4 = power_low]
</block>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct
values.first_key values.first_key_latency values.second_key values.second_key_latency values.correctkeys)
/ separatefiles = true
</data>

Edited 4 Years Ago by Dave
clarkm
clarkm
Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)Associate Member (271 reputation)
Group: Forum Members
Posts: 8, Visits: 159
Hi all!

I am creating a simple experiment where participants see a picture of an object, followed by a sound, and must respond with two simultaneous key presses. When participants respond, it should immediately go on to the next trial. The following code does that, which is great. However, I would like it so that pressing just ONE key (either 34 or 38) is recorded as an incorrect response. Currently, pressing just one key does nothing and Inquisit waits for a second key press before moving onto the next trial. 

I am assuming the problem lies somewhere in the <trial> element (see below). Anyone have any ideas? 

Thank you all in advance :-)


<trial power_low>
/ inputdevice = keyboard
/ ontrialbegin = [list.bigstims.nextvalue]
/ ontrialbegin = [values.Grip = "WHG"; values.Tone = "low"]
/ ontrialbegin = [values.first_key=0; values.first_key_latency=0;
  values.second_key=0; values.second_key_latency = 0;
  values.correctkeys = "34, 38"; ]
/ stimulustimes = [1 = big_objects; 2000 = sound.low]
/ validresponse = (34, 38)
/ isvalidresponse = [if(values.first_key==0) {
  values.first_key=trial.power_low.response;
  values.first_key_latency=trial.power_low.latency;
  false; };
  if (values.first_key != 0 && trial.power_low.latency>values.first_key_latency) {
  values.second_key=trial.power_low.response;
  values.second_key_latency = trial.power_low.latency;
  false; };
  values.first_key != 0 && values.second_key != 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)
                        && (values.first_key != values.second_key)]
/ beginresponsetime = 2000
/ responseinterrupt = immediate
/ recorddata = true
/ timeout = (7000)
/ branch = [if (trial.power_low.error) trial.errorfb]
/ branch = [if (trial.power_low.correct) trial.correctfb]
</trial>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search