Millisecond Forums

Breaks at modifiable intervals

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

By SamSam - 5/2/2016

Greetings,

We are trying to introduce breaks into our experiment and thought of doing it the following way: We have six different trials and we would like to have a (seventh) breaktrial every 'x' amount of trials. We thought of adding to every trial an /ontrialbegin add '+1' to a counter, and add at the end of a trial a conditional branch to the break trial if said trial counter reaches 'x'. At the end of the break trial, we would then add an /ontrialend reset the counter. However, we just cannot figure out how to add this counter; expressions and values don't seem to work... Things like totaltrialcount we can't use because it can't be reset and trialcount doesn't sum over the 6 different trials.

Any tips on how to make this work, or otherwise alternative ideas to implement breaks in this way? (We prefer to avoid using the elapsedtime variable.)

Thanks a ton in advance!
By Dave - 5/3/2016

A <values> entry is exactly what you should use. Increase the value by one in each of your "regular" trials (the six <trial> elements you mentioned). /branch from those trials to the "break" <trial> element if the trialcount value is equal to "x". In the "break" <trial>, reset the value back to zero. Quick example:

<values>
/ trialcounter = 0
/ break_after_n = 4
</values>

<block myblock>
/ trials = [1-20 = noreplace(a,b)]
</block>

<trial a>
/ pretrialpause = 500
/ ontrialbegin = [values.trialcounter += 1]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ branch = [if (values.trialcounter == values.break_after_n) trial.break]
</trial>

<trial b>
/ pretrialpause = 500
/ ontrialbegin = [values.trialcounter += 1]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ branch = [if (values.trialcounter == values.break_after_n) trial.break]
</trial>

<trial break>
/ ontrialend = [values.trialcounter = 0]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%script.currenttrial%>")
</text>

After every set of 4 "regular" trials, a "break" will be invoked.
By SamSam - 5/3/2016

Ah, we were so close... This works perfectly. Thanks again, Dave! Much appreciated.