Millisecond Forums

Inquisit does not pick up all responses

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

By Sercan - 4/13/2017

Hi! 
I'm trying to create a keyboard version of the approach/avoidance task by Wiers et al. (2009) for which you so kindly provided the code. The presented image should zoom in when the participant presses the downward arrow key, and it should zoom out when the upward arrow key is pressed. When the keys are released, the image should remain still, not zooming in or out. Lastly, when a key is pressed, zooming should resume until the image is gone or very big. 

The problem I'm facing is that inquisit cannot detect if a key is currently being held, and apparently also does not pick up all responses when trial duration is very short.

The code I wrote down here makes complete sense to me. However, it does not work in Inquisit 5. Key presses and releases during zooming are picked up only 1/3 of the time, and/or the branching mechanism does not do what it should. I'm not sure which one. Please help me out!


<trial practicetrial_A>
/ ontrialbegin = [
values.selectpracticepicture = list.pract.nextvalue;
values.cresp = list.pract.currentvalue;
values.starttime = script.elapsedtime;
values.endtime = 0;
picture.practicetarget.height = values.startheight_A;
values.completeRT = 0;
values.changedirection = 0;
values.keys_y=0;
values.finalresponse="";
]
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, 208, noresponse)
/ iscorrectresponse = [(values.cresp == 1 && trial.practicetrial_A.response == 200) ||
(values.cresp == 2 && trial.practicetrial_A.response == 208)]
/ errormessage = true(error,0)
/ ontrialend = [
if (trial.practicetrial_A.response == 200){
values.initialresponse = "PUSH";
}else {
values.initialresponse = "PULL";
}
]
/ branch = [
if (trial.practicetrial_A.response == 200)
trial.practicedecrease
else
trial.practiceincrease;
]
/ recorddata = false
</trial>

<trial practicedecrease>
/ ontrialbegin = [
if (list.pract.currentvalue == 2){
values.intromistake=1;
} else values.intromistake=0;
values.keys_y-=1;
picture.practicetarget.height = values.startheight_A + values.keys_y * 0.05 * expressions.maxheightchange_px;
]
/ stimulusframes = [1 = clearscreen, practicetarget]
/ validresponse = (208,-200, noresponse)
/ branch = [
if (values.keys_y <= -20) {
values.finalresponse = "PUSH";
trial.InterTrialInterval;
};
if (trial.practicedecrease.response == 208) {
values.changedirection += 1;
trial.practiceincrease;
};
if (trial.practicedecrease.response != -200){
trial.practicedecrease;
} else trial.practiceidle;
]
/ recorddata = false
/ trialduration=32
</trial>

<trial practiceincrease>
/ ontrialbegin = [
if (list.pract.currentvalue==1){
values.intromistake=1;
} else values.intromistake=0;
values.keys_y+=1;
picture.practicetarget.height = values.startheight_A + values.keys_y* 0.05 * expressions.maxheightchange_px;
]
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, -208, noresponse)
/ branch = [
if (values.keys_y >= 20) {
values.finalresponse = "PULL";
trial.InterTrialInterval;
} else if (trial.practiceincrease.response==200) {
values.changedirection += 1;
trial.practicedecrease;
};
if (trial.practiceincrease.response!=-208){
trial.practiceincrease;
}else trial.practiceidle]
/ recorddata = false
/ trialduration=32
</trial>

<trial practiceidle>
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, 208)
/ branch = [
if (trial.practiceidle.response==208) {
trial.practiceincrease;
} else if (trial.practiceidle.response==200) {
trial.practicedecrease;
} else trial.practiceidle;]
/ recorddata = false
/ trialduration=32
</trial>

By Dave - 4/13/2017

Sercan Kahveci - Thursday, April 13, 2017
Hi! 
I'm trying to create a keyboard version of the approach/avoidance task by Wiers et al. (2009) for which you so kindly provided the code. The presented image should zoom in when the participant presses the downward arrow key, and it should zoom out when the upward arrow key is pressed. When the keys are released, the image should remain still, not zooming in or out. Lastly, when a key is pressed, zooming should resume until the image is gone or very big. 

The problem I'm facing is that inquisit cannot detect if a key is currently being held, and apparently also does not pick up all responses when trial duration is very short.

The code I wrote down here makes complete sense to me. However, it does not work in Inquisit 5. Key presses and releases during zooming are picked up only 1/3 of the time, and/or the branching mechanism does not do what it should. I'm not sure which one. Please help me out!


<trial practicetrial_A>
/ ontrialbegin = [
values.selectpracticepicture = list.pract.nextvalue;
values.cresp = list.pract.currentvalue;
values.starttime = script.elapsedtime;
values.endtime = 0;
picture.practicetarget.height = values.startheight_A;
values.completeRT = 0;
values.changedirection = 0;
values.keys_y=0;
values.finalresponse="";
]
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, 208, noresponse)
/ iscorrectresponse = [(values.cresp == 1 && trial.practicetrial_A.response == 200) ||
(values.cresp == 2 && trial.practicetrial_A.response == 208)]
/ errormessage = true(error,0)
/ ontrialend = [
if (trial.practicetrial_A.response == 200){
values.initialresponse = "PUSH";
}else {
values.initialresponse = "PULL";
}
]
/ branch = [
if (trial.practicetrial_A.response == 200)
trial.practicedecrease
else
trial.practiceincrease;
]
/ recorddata = false
</trial>

<trial practicedecrease>
/ ontrialbegin = [
if (list.pract.currentvalue == 2){
values.intromistake=1;
} else values.intromistake=0;
values.keys_y-=1;
picture.practicetarget.height = values.startheight_A + values.keys_y * 0.05 * expressions.maxheightchange_px;
]
/ stimulusframes = [1 = clearscreen, practicetarget]
/ validresponse = (208,-200, noresponse)
/ branch = [
if (values.keys_y <= -20) {
values.finalresponse = "PUSH";
trial.InterTrialInterval;
};
if (trial.practicedecrease.response == 208) {
values.changedirection += 1;
trial.practiceincrease;
};
if (trial.practicedecrease.response != -200){
trial.practicedecrease;
} else trial.practiceidle;
]
/ recorddata = false
/ trialduration=32
</trial>

<trial practiceincrease>
/ ontrialbegin = [
if (list.pract.currentvalue==1){
values.intromistake=1;
} else values.intromistake=0;
values.keys_y+=1;
picture.practicetarget.height = values.startheight_A + values.keys_y* 0.05 * expressions.maxheightchange_px;
]
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, -208, noresponse)
/ branch = [
if (values.keys_y >= 20) {
values.finalresponse = "PULL";
trial.InterTrialInterval;
} else if (trial.practiceincrease.response==200) {
values.changedirection += 1;
trial.practicedecrease;
};
if (trial.practiceincrease.response!=-208){
trial.practiceincrease;
}else trial.practiceidle]
/ recorddata = false
/ trialduration=32
</trial>

<trial practiceidle>
/ stimulusframes = [1 = practicetarget]
/ validresponse = (200, 208)
/ branch = [
if (trial.practiceidle.response==208) {
trial.practiceincrease;
} else if (trial.practiceidle.response==200) {
trial.practicedecrease;
} else trial.practiceidle;]
/ recorddata = false
/ trialduration=32
</trial>


There is no good solution here:
#1: Different keyboards have substantially varying measurement errors associated with them. For many keyboards, the 32ms duration you specified falls well within their measurement error. The only thing you can do here is to increase the duration to increase the likelihood of key presses and releases being picked up.
#2: If a key press or release falls right within the (short) transition period from one trial to the next, it won't be picked up. In other words, keyboard input for this type of task tends to be less than ideal.
#3: Whether there are any other issues with the code is frankly impossible to assess based on the isolated snippet you posted.