Hi there,
Well, I thought my response box troubles were behind me, but alas...
I've moved on to trying to get our response pad to work with N-back, where either no response or an active response can be correct responses depending on the (non)target stimulus. Looking at the data, nonresponses are logging just fine, but it isn't registering any XID button presses. Here's the relevant code I'm using:
<trial start>
/ ontrialbegin = [
if (values.N == 0) {
text.targetreminder.textcolor = red;
values.trialduration_starttrial = parameters.showtarget0;
values.starttrialposttrialpause = parameters.posttrialpause_aftertarget0;
} else {
trial.start.insertstimulustime(clearscreen, parameters.stimulusPresentationtime);
values.trialduration_starttrial = parameters.trialduration;
values.starttrialposttrialpause = 0;
};
values.starttrialcounter += 1;
values.trial_Hit = 0;
values.trial_Miss = 0;
values.trial_CR = 0;
values.trial_FA = 0;
]
/ stimulustimes = [0 = startletter, targetreminder]
/ inputdevice = xid
/ isvalidresponse = [
trial.start.response == 80
]
/ validresponse = (noresponse)
/ correctresponse = (noresponse)/ ontrialend = [
trial.start.resetstimulusframes();
if (values.N == 0) {
values.currenttarget = text.startletter.currentitemnumber;
}
list.items.insertitem(text.startletter.currentitemnumber, 1);
text.targetreminder.textcolor = black;
]
/ beginresponsetime = 0
/ trialduration = values.trialduration_starttrial
/ posttrialpause = (values.starttrialposttrialpause)
/ branch = [
if (values.starttrialcounter < values.N)
trial.start
]
</trial>
**********************************
Nontarget Trials
**********************************
<trial nontarget>
/ stimulustimes = [0 = nontargetletter]
/ inputdevice = xid
/ isvalidresponse = [
trial.nontarget.response == 80
]
/ validresponse = (noresponse)
/ correctresponse = (noresponse)/ ontrialbegin = [
trial.nontarget.insertstimulustime(clearscreen, parameters.stimulusPresentationtime);
if (values.N > 0) {
values.currenttarget = list.items.item(values.N);
};
values.trial_Hit = 0;
values.trial_Miss = 0;
values.trial_CR = 0;
values.trial_FA = 0;
]
/ ontrialend = [
trial.nontarget.resetstimulusframes();
list.items.insertitem(text.nontargetletter.currentitemnumber, 1);
values.CorrReject = values.CorrReject + trial.nontarget.correct;
values.trial_CR = trial.nontarget.correct;
values.FalseA = values.FalseA + trial.nontarget.error;
values.trial_FA = trial.nontarget.error;
values.TotalFA = values.TotalFA + trial.nontarget.error;
values.DV = (values.TotalHits - values.TotalFA)/values.TotalBlocks;
]
/ beginresponsetime = 0
/ trialduration = parameters.trialduration
</trial>
**********************************
Target Trials
**********************************
**if target, press the letter "A" (code: 30)
<trial target>
/ stimulustimes = [0 = targetletter, targetalert]
/ inputdevice = xid
/ isvalidresponse = [
trial.target.response == 80
]
/ validresponse = (noresponse)
/ correctresponse = (80)/ ontrialbegin = [
trial.target.insertstimulustime(clearscreen, parameters.stimulusPresentationtime);
if (values.N > 0) {
values.currenttarget = list.items.item(values.N);
};
values.trial_Hit = 0;
values.trial_Miss = 0;
values.trial_CR = 0;
values.trial_FA = 0;
]
/ ontrialend = [
trial.target.resetstimulusframes();
list.items.insertitem(text.targetletter.currentitemnumber, 1);
values.Hits = values.Hits+ trial.target.correct;
values.trial_Hit = trial.target.correct;
values.Misses = values.Misses + trial.target.error;
values.trial_Miss = trial.target.error;
values.TotalHits = values.TotalHits + trial.target.correct;
values.DV = (values.TotalHits - values.TotalFA)/values.TotalBlocks;
]
/ beginresponsetime = 0
/ trialduration = parameters.trialduration
</trial>