Counting clicks in a trial


Author
Message
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
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.
Amelinq
Amelinq
Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)Associate Member (291 reputation)
Group: Forum Members
Posts: 22, Visits: 63
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>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search