psychopy.org | Reference | Downloads | Github

Control logic ends trials offline but not online

My experiment uses a number of counters. If a counter reaches a specific value, the within-block or the across-block loop (= the whole experiment) should end.

## Begin experiment
trial_counter = 0
number_correct = 0
number_incorrect = 0
previous_trial_bad = 0
## End Routine
if resp.corr == 1:
    number_correct = number_correct + 1
else:
    number_incorrect = number_incorrect + 1

if trial_counter > 4:
    trial_counter = 0
    previous_trial_bad = 0
    within_block.finished = True

if number_correct > 1:
    number_correct = 0
    number_incorrect = 0
    previous_trial_bad = 0
    within_block.finished = True

if (number_incorrect > 2) and (previous_trial_bad == 1):
    within_block.finished = True
    across_block.finished = True
elif number_incorrect > 2:
    number_correct = 0

This works offline but not on Pavlovia. On Pavlovia, the experiment keeps going until it runs out of stimuli.

I’ve seen this referenced elsewhere but lost track of where the issue is at the moment and whether it got resolved (Loop.finished=true No longer working, and elsewhere, I can only post two links)

The project is here: