If this template helps then use it. If not then just delete and start from scratch.
PsychoPy version 3-3.1.5 (Builder)
(Sorry for my english, i am French)
Hi, in my experiment, a participant has to complete a mental fatigue task, its an alternation of numbers and letters. They have to press “2” when the number is even, “3” when he is odd, and “space” if 2 identical letters follow each other.
I want to make it end when participants get at least 85% of the trials in the last block correct before they can finish.
If the participant gets less than 85% the task continue.
Also, the letters and numbers should continue to scroll even if the participants does not respond. Finally, the STD (stimulus time duration) of letters and numbers must adapt to the participant respond time.
I try this :
ACQkeyRespcorrs =  minNrPractice = 36 # min number of trials to practice considerNrTrials = 12 # number of trials to consider for accuracy calculation minAccuracy = 0.9
respcorrs.append(resp.corr) # assumes your keyboard component is called "ACQkeyResp" if len(respcorrs) >= minNrPractice: respcorrsRecent = respcorrs[-considerNrTrials:] respcorrsSum = sum(respcorrsRecent) # only works if error=0 and correct=1 accuracy = float(respcorrsSum)/considerNrTrials if accuracy >= minAccuracy: break
I found this on the forum, but i don’t know if its the good solution, i am a beginner in Psychopy