Millisecond Forums

Counting clicks in a trial

https://forums.millisecond.com/Topic41495.aspx

By Amelinq - 8/11/2025

Hi all,
Does anyone know an elegant way to randomize between 'butterfly-trials' in which participants have to click 1, 2, 3 or 4 times to make a video play? Now I made the trials loop in eachother, but it makes the dataframe messy. The first trial in the block should be a one-click-butterfly and the second trial a second-click butterfly, and then they should be at random a one-click, two-click, three-click or four-click butterfly trial.

thankyou!

<block instrumental>

/trials = [1 = trial.butterflytrial1; 2= butterflytrial2; 3-10 = random(butterflytrial1, butterflytrial2,butterflytrial3,butterflytrial4)]
/ preInstructions = (instr)
/ timeout = 600000
</block>

<trial butterflytrial1>
/stimulustimes = [0 = butterfly]
/inputdevice = touchscreen
/correctresponse = (butterfly)
/responseinterrupt = trial
/branch = {
  if (trial.butterflytrial1.correct) {
   return trial.videofeedback;
  }
}
</trial>
<trial butterflytrial2>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial2.correct == true) {
   return trial.butterflytrial1;
  }
}
/ responseinterrupt = trial
</trial>
<trial butterflytrial3>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial3.correct == true) {
   return trial.butterflytrial2;
  }
}
/ responseinterrupt = trial
</trial>
<trial butterflytrial4>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial4.correct == true) {
   return trial.butterflytrial3;
  }
}
/ responseinterrupt = trial
</trial>
By Dave - 8/11/2025

Amelinq - 8/11/2025
Hi all,
Does anyone know an elegant way to randomize between 'butterfly-trials' in which participants have to click 1, 2, 3 or 4 times to make a video play? Now I made the trials loop in eachother, but it makes the dataframe messy. The first trial in the block should be a one-click-butterfly and the second trial a second-click butterfly, and then they should be at random a one-click, two-click, three-click or four-click butterfly trial.

thankyou!

<block instrumental>

/trials = [1 = trial.butterflytrial1; 2= butterflytrial2; 3-10 = random(butterflytrial1, butterflytrial2,butterflytrial3,butterflytrial4)]
/ preInstructions = (instr)
/ timeout = 600000
</block>

<trial butterflytrial1>
/stimulustimes = [0 = butterfly]
/inputdevice = touchscreen
/correctresponse = (butterfly)
/responseinterrupt = trial
/branch = {
  if (trial.butterflytrial1.correct) {
   return trial.videofeedback;
  }
}
</trial>
<trial butterflytrial2>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial2.correct == true) {
   return trial.butterflytrial1;
  }
}
/ responseinterrupt = trial
</trial>
<trial butterflytrial3>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial3.correct == true) {
   return trial.butterflytrial2;
  }
}
/ responseinterrupt = trial
</trial>
<trial butterflytrial4>
/ stimulustimes = [0= butterfly]
/ inputdevice = touchscreen
/ correctResponse = (butterfly)
/branch= {
    if (trial.butterflytrial4.correct == true) {
   return trial.butterflytrial3;
  }
}
/ responseinterrupt = trial
</trial>

Please provide runnable code, it's entirely impossible to understand what you are doing based on these few uncommented snippets.