Millisecond Forums

Multiple valid responses, correct responses, and XID

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

By drtb - 2/28/2019

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>
By Dave - 3/1/2019

drtb - Friday, March 1, 2019
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>

In your <trial> elements, using /validresponse = (noresponse) looks wrong.

It should be /validresponse = (anyresponse) and multiple valid responses via /isvalidresponse can be defined like so

<trial nontarget>
/ stimulustimes = [0 = nontargetletter]
/ inputdevice = xid
/ isvalidresponse = [
trial.nontarget.response == 80 || trial.nontarget.response == 0
]
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.nontarget.response == 0]
....
</trial>


<trial target>
/ stimulustimes = [0 = targetletter, targetalert]
/ inputdevice = xid
/ isvalidresponse = [
trial.target.response == 80 || trial.target.response == 0
]
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.target.response == 80]
...
</trial>
By drtb - 3/1/2019

Dave - Friday, March 1, 2019
drtb - Friday, March 1, 2019
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>

In your <trial> elements, using /validresponse = (noresponse) looks wrong.

It should be /validresponse = (anyresponse) and multiple valid responses via /isvalidresponse can be defined like so

<trial nontarget>
/ stimulustimes = [0 = nontargetletter]
/ inputdevice = xid
/ isvalidresponse = [
trial.nontarget.response == 80 || trial.nontarget.response == 0
]
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.nontarget.response == 0]
....
</trial>


<trial target>
/ stimulustimes = [0 = targetletter, targetalert]
/ inputdevice = xid
/ isvalidresponse = [
trial.target.response == 80 || trial.target.response == 0
]
/ validresponse = (anyresponse)
/ iscorrectresponse = [trial.target.response == 80]
...
</trial>

Dave: if God does exist and there is a heaven, you will surely be among the first of its citizens. After failing miserably for hours on end, your code worked immediately. I bow to your infinite glory and wisdom. From the deepest corners of my heart, I thank you.