-
Hello! I’ve been stuck on a really strange problem with using the The context: I have a trial variable ( The problem: more repetitions are sometimes displayed than specified in Since the pattern corresponds to the ‘boundaries’ defined in Would anyone happen to have any ideas? Thanks so much for any pointers! // here's the code for context
// this variable represents the timeline that will be returned, if the value of trialN corresponds with that of a target trial
var ifTarget = {
timeline: [dimQ, dimQ_postdeadline, accumulate_dimQ_index, decision_LP, feedbackPartial], // this is the sequence presented for each trial if trialN tells us it's a target trial. Each variable in this array has its own 'type', 'stimulus', 'choices' etc. parameters)
conditional_function: function(){
if (dimQ_condition == "withDimQ"){
if ((trialN >= 16 && trialN < 32) | (trialN >= 48 && trialN < 64) | (trialN >= 80 && trialN < 96) | (trialN >= 112)){ /// I think this might be interacting with REPETITIONS given the pattern in the errors.
//also if I change the part in the first bracket to trialN < 33 then set repetitions = 32, there are no extra trials shown
//console.log('ifTarget, trialN = ' + trialN)
return true
} else {return false}
} else {return false}
},
}
// this variable represents the timeline that will be returned, if the value of trialN corresponds with that of a non-target trial
var ifNontarget = {
timeline: [decision_LP, feedbackPartial], // this is the sequence presented for each trial if trialN tells us it's not a target trial
conditional_function: function(){
if (dimQ_condition == "withDimQ"){
if ((trialN >= 16 && trialN < 32) | (trialN >= 48 && trialN < 64) | (trialN >= 80 && trialN < 96) | (trialN >= 112)){
return false
} else {
//console.log('ifNontarget, trialN = ' + trialN)
return true;
}
} else {return false}
},
}
var LP = {
timeline: [ifTarget, ifNontarget], // only ONE of these will be displayed since the other will be skipped
repetitions: 32, // for example...
};
timeline.push(LP);
// note: if the console.log messages are included, there isn’t any trial where both console.log messages are shown (i.e., no trials that seem to be fulfilling conditions for both ifTarget and ifNontarget |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Update: this has been solved with help outside of the forum! Just in case anyone's having the same problem, it was due to trialN accumulating at the end of |
Beta Was this translation helpful? Give feedback.
Update: this has been solved with help outside of the forum!
Just in case anyone's having the same problem, it was due to trialN accumulating at the end of
feedbackPartial
. That meant that ontrialN = 31
(the 32nd repetition),ifTarget
is run and at the endtrialN
becomes 32. However becauseifNontarget
is still run within the same 32nd repetition ofLP
,trialN = 32
ends up returning true for the conditional inifNontarget
, which results in the extra trial.