-
|
Hi, I am migrating from v7 to v8 and need help with a conditional function. I need the conditional function to evaluate on every trial, not just on the first one. This is my code for the conditional function: And here is the full code. The conditional function is in the variable Thanks a lot for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Hi again, I did some tests and I think the problem is specific to the The same code worked fine with version 3.7 of the Thanks a lot for your help! |
Beta Was this translation helpful? Give feedback.
-
|
Hi @kittymimo , Thank you for using my plugin! I’m not sure if I understood your question correctly, but you should probably define the I haven't tested this code yet, but please try the following and see if it works. stimuli: function() {
let img_file_name, audio_file_name;
const last_trial_correct = jsPsych.data.get().last(1).values()[0].correct;
if(last_trial_correct) {
img_file_name = "images/crochet.png";
audio_file_name = "audio/correct.wav";
} else {
img_file_name = "images/x.png";
audio_file_name = "audio/incorrect.wav";
}
const stimuli = [
{
obj_type: "image",
file: img_file_name,
startX: 0,
startY: 0,
origin_center: true,
image_height: 163,
show_end_time: 1400
},
{
obj_type: "sound",
file: audio_file_name
},
{
obj_type: "sound",
file: "audio/voici_la_bonne_reponse.wav",
show_start_time: 1400,
trial_ends_after_audio: true
},
{
obj_type: "text",
content: "+",
font: "40px arial",
show_start_time: 1400
},
];
return stimuli;
},Best, |
Beta Was this translation helpful? Give feedback.
Hi @kittymimo ,
Thank you for using my plugin!
I’m not sure if I understood your question correctly, but you should probably define the
stimulias a function instead of usingon_start.I haven't tested this code yet, but please try the following and see if it works.
Please remove the
on_startsection.