-
Hi, I have a task that presents a series of colour words in different colours (much like the stroop test). In my task, participants respond with 'a' if the word and the colour are not the same (i.e., lure = 0) and respond with a number (1, 2, 3, or 4) if the word and the colour are the same (i.e., lure = 1). When participants make two consecutive lure errors (i.e., they press 'a' on two lure trials in a row), I would like to present them with a conditional trial immediately following the second error. Below is a snippet of my code (with just a subset of the trial stimuli). I have created a variable called feedback and would like to create a conditional function for this but am not sure how to go about it. Essentially I need to keep track of the participant's response on the previous lure trial. If the previous lure and the current lure are both incorrect then a feedback trial is presented. Once the feedback trial is presented, this 'error count' should be set back to zero and will begin again the next time they make a lure error. Thanks in advance! var test_stimuli = [
{
"stimulus": "<p id = 'stroop_stim' style = 'color: red; font-size: 60pt;'>red<\/p>",
"data": {
"word": "red",
"color": "red",
"lure": 1
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: green; font-size: 60pt;'>red<\/p>",
"data": {
"word": "red",
"color": "green",
"lure": 0
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: blue; font-size: 60pt;'>red<\/p>",
"data": {
"word": "red",
"color": "blue",
"lure": 0
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: yellow; font-size: 60pt;'>red<\/p>",
"data": {
"word": "red",
"color": "yellow",
"lure": 0
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: red; font-size: 60pt;'>green<\/p>",
"data": {
"word": "green",
"color": "red",
"lure": 0
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: green; font-size: 60pt;'>green<\/p>",
"data": {
"word": "green",
"color": "green",
"lure": 1
}
},
{
"stimulus": "<p id = 'stroop_stim' style = 'color: blue; font-size: 60pt;'>green<\/p>",
"data": {
"word": "green",
"color": "blue",
"lure": 0
}
}
]
var test = {
type: "html-keyboard-response",
response_ends_trial: false,
stimulus: jsPsych.timelineVariable('stimulus'),
data: jsPsych.timelineVariable('data'),
on_finish: function(data){
var correct = false;
if(data.lure == 0 && data.key_press == 'a'){
correct = true;
} else if(data.lure == 1 && data.key_press != 'a'){
correct = true;
}
data.correct = correct;
},
choices: ['a', '1', '2', '3', '4'],
trial_duration: 500,
post_trial_gap: 600
}
var feedback = {
type: 'html-keyboard-response',
stimulus: '<span style = "font-size: 60px;">?</span>',
choices: jsPsych.NO_KEYS,
trial_duration: 1500,
post_trial_gap: 600,
conditional_function: function() {
}
}
var test_procedure = {
timeline: [test, feedback],
timeline_variables: test_stimuli,
randomize_order: false,
repetitions: 0
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi, a while back I had a similar problem. The solution posted here (#748) might help you. |
Beta Was this translation helpful? Give feedback.
Hi,
a while back I had a similar problem. The solution posted here (#748) might help you.