The stop command specifies the conditions in which an expt or block should be terminated.
<block> <expt> <likert> <openended> <sliderTrial> <surveyPage> <trial>
Name | Type | Description |
---|---|---|
script | script | Specifies the expression to evaluate to determine whether the expt or block should stop. |
The stop command enables a script to conditionally end an expt or block based on whether a logical expression is true. The expression can evaluate the subject's performance, the current state of the experiment, the elapsed time, and other variables as well. You may specify multiple expressions separated by semi-colons, or contained in separate stop commands. The stop conditions are evaluated after each trial is complete. If any single condition is true, the expt or block ends. Otherwise, the expt or block continues.
The attribute requires an explicit 'return' statement.
The following block is interrupted if the subject gives 5 incorrect answers in a row, or if mean response latency on testtrials drifts above 1000 milliseconds:
<block myBlock>
/ trials=[1-20=noreplace(testtrials, distractortrials)]
/ stop={
return (this.errorStreak >= 5 || trial.testtrials.meanLatency >= 1000);
}
</block>