Skip to content
Discussion options

You must be logged in to vote

Hi @mbeasle2

This is the expected behavior for timeline variables and loop functions. When you add timeline variables to a timeline, the default behavior is to run the timeline once for each entry in the timeline variables array. The loop function runs at the end of this to see if the whole timeline should run again.

You can customize how the timeline variables are sampled using the sample parameter. A simple version would be to just sample one trial:

var mathQuestionProcedure = {
  timeline: [test], // loop the trial
  timeline_variables: mathQuestions,
  sample: {
    type: 'with-replacement',
    size: 1
  },
  loop_function: function(data) {
    if (acc < 2) {
            return true; /…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mbeasle2
Comment options

Answer selected by mbeasle2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants