Millisecond Forums

Adding error feedback to downloaded AAT script

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

By drud9876 - 8/28/2019

Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.
By Dave - 8/28/2019

drud9876 - 8/29/2019
Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.

If you want to display error feedback *after* each trial, can fold that into the enddecrease and endincrease <trial> elements. Something like that:

<trial endincrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "l") {
trial.endincrease.insertstimulustime(text.error, 0);
} else if (values.expcondition == 2 && values.targetformat == "p"){
trial.endincrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

By Dave - 8/28/2019

Dave - 8/29/2019
drud9876 - 8/29/2019
Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.

If you want to display error feedback *after* each trial, can fold that into the enddecrease and endincrease <trial> elements. Something like that:

<trial endincrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "l") {
trial.endincrease.insertstimulustime(text.error, 0);
} else if (values.expcondition == 2 && values.targetformat == "p"){
trial.endincrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>


Note that the above would give feedback based on the final response. If you want to give feedback based on the initial response, i.e. whether the direction the participant initially moved the joystick in was wrong, do the same based on values.correct. I.e.

<trial endincrease>
/ ontrialbegin = [
if (!values.correct) {
trial.endincrease.insertstimulustime(text.error, 0);
};

]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>
By drud9876 - 9/2/2019

Dave - 8/29/2019
drud9876 - 8/29/2019
Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.

If you want to display error feedback *after* each trial, can fold that into the enddecrease and endincrease <trial> elements. Something like that:

<trial endincrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "l") {
trial.endincrease.insertstimulustime(text.error, 0);
} else if (values.expcondition == 2 && values.targetformat == "p"){
trial.endincrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>


Hi Dave,

Thanks so much for your suggestion. I've pasted in this code but it seems to have introduced a new problem.

The error message is now displaying correctly but the task now seems to freeze for an inordinate amount of time at the end of each trial regardless of whether the response was correct or incorrect. It seems to only move onto the next trial when I click a button on the joystick (not sure if this is my imagination or something is going on here??)

do you have any idea why this might be the case?

I've attached a copy of the current code I'm using

Thanks!
By Dave - 9/2/2019

drud9876 - 9/2/2019
Dave - 8/29/2019
drud9876 - 8/29/2019
Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.

If you want to display error feedback *after* each trial, can fold that into the enddecrease and endincrease <trial> elements. Something like that:

<trial endincrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "l") {
trial.endincrease.insertstimulustime(text.error, 0);
} else if (values.expcondition == 2 && values.targetformat == "p"){
trial.endincrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>


Hi Dave,

Thanks so much for your suggestion. I've pasted in this code but it seems to have introduced a new problem.

The error message is now displaying correctly but the task now seems to freeze for an inordinate amount of time at the end of each trial regardless of whether the response was correct or incorrect. It seems to only move onto the next trial when I click a button on the joystick (not sure if this is my imagination or something is going on here??)

do you have any idea why this might be the case?

I've attached a copy of the current code I'm using

Thanks!

Could you please specify what "inordinate amount of time" means? The endincrease and enddecrease trials are set to a fixed duration of 2 seconds in the code per /trialduration, and then they move to the joystickrest trial which waits for the joystick to move back to its center position before beginning the next round of trials.

Based on that I can see the following scenario: In the event that the joystick was already moved into the resting position during the 2-second duration of the endincrease or enddecrease trial, the joystickrest trial will sit there and wait until something happens, e.g. joystick gets moved slightly away from the resting position and then back. Would that be in line with what you're seeing?
By drud9876 - 9/3/2019

Dave - 9/3/2019
drud9876 - 9/2/2019
Dave - 8/29/2019
drud9876 - 8/29/2019
Hi there, hoping someone can help.

I've downloaded the AAT script from the website and modified it to show my images and its all working well. What I want to do now is display a message to participants saying "Incorrect" after each trial where they make an error.

I've tried putting the /errormessage option in the block but this seems to mess things up a lot and doesn't work.

Has anyone had any success in adding error feedback to this script?

I've attached my working version of the script but I haven't made many changes to the downloaded script other than to the items and the number of stimulus categories/trial types.

If you want to display error feedback *after* each trial, can fold that into the enddecrease and endincrease <trial> elements. Something like that:

<trial endincrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "l") {
trial.endincrease.insertstimulustime(text.error, 0);
} else if (values.expcondition == 2 && values.targetformat == "p"){
trial.endincrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height + values.joystick_change/1000 * expressions.maxheightchange_px
]
/ ontrialend = [
trial.endincrease.resetstimulusframes();
]
/ stimulusframes = [1 = targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>

<trial enddecrease>
/ ontrialbegin = [
if (values.expcondition == 1 && values.targetformat == "p"){
trial.enddecrease.insertstimulustime(text.error, 0);
}else if (values.expcondition == 2 && values.targetformat == "l"){
trial.enddecrease.insertstimulustime(text.error, 0);
};
]
/ ontrialbegin = [
picture.targetstimulus.height = picture.targetstimulus.height - values.joystick_change/1000 * expressions.maxheightchange_px;
]
/ ontrialend = [
trial.enddecrease.resetstimulusframes();
]
/ stimulusframes = [1 = clearscreen, targetstimulus]
/ trialduration = 2000
/ branch = [trial.joystickrest]
/ recorddata = false
</trial>


Hi Dave,

Thanks so much for your suggestion. I've pasted in this code but it seems to have introduced a new problem.

The error message is now displaying correctly but the task now seems to freeze for an inordinate amount of time at the end of each trial regardless of whether the response was correct or incorrect. It seems to only move onto the next trial when I click a button on the joystick (not sure if this is my imagination or something is going on here??)

do you have any idea why this might be the case?

I've attached a copy of the current code I'm using

Thanks!

Could you please specify what "inordinate amount of time" means? The endincrease and enddecrease trials are set to a fixed duration of 2 seconds in the code per /trialduration, and then they move to the joystickrest trial which waits for the joystick to move back to its center position before beginning the next round of trials.

Based on that I can see the following scenario: In the event that the joystick was already moved into the resting position during the 2-second duration of the endincrease or enddecrease trial, the joystickrest trial will sit there and wait until something happens, e.g. joystick gets moved slightly away from the resting position and then back. Would that be in line with what you're seeing?

Yes that must be what is happening. Because I am definitely returning the joystick to the center within the 2 second window and then the trial gets "stuck" until I press something or move the joystick slightly. 
By Dave - 9/3/2019

drud9876 - 9/3/2019

Yes that must be what is happening. Because I am definitely returning the joystick to the center within the 2 second window and then the trial gets "stuck" until I press something or move the joystick slightly. 

Okay. I assume you want the error feedback displayed for some sizeable amount of time -- it need not be 2 seconds, perhaps, but you won't want it to vanish after the briefest amount of time either, so I don't see any ideal way to prevent this from happening. Maybe adding some on-screen instructions to the joystickrest trial is an option? E.g. "Please move the joystick to its center position now."

Alternatively, you could /branch from the endincrease and enddecrease trials to a separate error feedback trial that requires joystick movement to terminate (i.e. joystick won't be in center position when that trial ends) -- from there then /branch to the joystickrest trial.