This example uses a Summation object and a trial counter to evaluate criteria for exiting a procedure.
The variables used in this sample are declared in the User Script (ALT+7) and initialized in the 'InitVars' InLine object.
On each trial, the accuracy value is averaged into the Summation object, and the trial counter is increased by one.
When the trial counter hits 5, the Summation object is evaluated on each trial. If the average accuracy of the Summation object reaches 80% or better at any point after 5 trials, the trials terminate. If not, they continue until all trials (20) have been run.
If all 20 trials have been run, and 80% accuracy has still not been reached, the experiment terminates altogether.