In the practice phase of my task I want to insert during a 1 ms blank screen a feedback that displays user's input latency after every trial.
How could I do that? also could I save the relevant data in one interaction and use it in the next interaction?
I want to insert the feedbank when 'blankcorrect' or 'blankerror' is triggered.
API.addTrialSets('base_local',[{
input: [
{handle:'left',on:'keypressed',key:'left'},
{handle:'right',on:'keypressed',key:'right'}
],
interactions: [
/* Display the cue stimulus. */
{
conditions:[{type:'begin'}],
actions: [
{type:'showStim',handle: 'fixation'},
{type:'removeInput',handle : ['left','right']},
{type:'setInput',input:{handle:'showMyStim', on:'timeout',duration:1000}}
]
},
{
conditions:[{type:'inputEquals',value:'showMyStim'}],
actions: [
{type:'resetTimer'},
{type:'hideStim',handle: 'fixation'},
{type:'showStim', handle: 'cue'},
{type:'setInput',input:{handle:'end',on:'timeout',duration:1500}},
{type:'setInput',input:{handle:'right',on: 'keypressed', key:['p','P']}},
{type:'setInput',input:{handle:'left',on: 'keypressed', key:['q','Q']}}
]
},
// ### Error feedback
// Lets add error feedback to our task.
// Above, we created the error stimulus. This creates a stimulus that displays a orange X at the bottom of the screen.
// Now that we have the error stimulus in place we can add the instruction how to display it.
// On incorrect responses we will display the error feedback, and trigger the end of the trial only after another 250 miliseconds.
/* Correct response actions */
{
conditions: [
{type:'inputEqualsStim',property:'correct_local'}
],
actions: [
{type:'setTrialAttr', setter:{score:1}},
{type:'setTrialAttr', setter:{message:'Correct response'}},
{type:'log'},
{type:'hideStim',handle:'cue'},
{type:'removeInput',handle:['left','right']},
{type:'removeInput',handle:'time'},
{type:'trigger', handle:'blankcorrect'}
]
},
/* Incorrect response actions */
{
conditions: [
{type:'inputEqualsStim',property:'correct_local',negate:true},
{type:'inputEquals',value:['left','right']}
],
actions: [
{type:'setTrialAttr', setter:{score:0}},
{type:'setTrialAttr', setter:{message:'Incorrect response'}},
{type:'log'},
{type:'removeInput',handle:['left','right']},
{type:'removeInput',handle:'time'},
{type:'hideStim',handle:'cue'},
{type:'trigger', handle:'blankerror'}
]
},
// . error feedback screen
{
conditions: [
{type:'inputEquals',value:'blankerror'},
{type:'trialEquals',property:'group',value:'practice_local'}
],
actions: [
{type:'showStim',handle:'error'},
{type:'trigger', handle:'end',on:'timeout',duration:1000}
]
},
// . correct feedback screen
{
conditions: [
{type:'inputEquals',value:'blankcorrect'},
{type:'trialEquals',property:'group',value:'practice_local'}
],
actions: [
{type:'showStim',handle:'correct'},
{type:'trigger', handle:'end',on:'timeout',duration:1000}
]
},
/* End trial */
{
conditions: [{type:'inputEquals', value:'end'}],
actions:[
{type:'hideStim',handle:'All'},
{type:'removeInput',handle:['left','right']},
{type:'endTrial'}
]
}
]
}]);