# Routine does not continue

**URL:** <https://discourse.psychopy.org/t/routine-does-not-continue/22211>\
**Category:** Builder\
**Created:** [April 12, 2021, 1:47am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211 "2021-04-12T01:47:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![psychisawesome](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@psychisawesome](https://discourse.psychopy.org/u/psychisawesome)\
**Post date:** [April 12, 2021, 1:47am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/1 "2021-04-12T01:47:29Z")

</div>

I have a current routine set up where in a routine there are 24 trials separated into 2 x 12trials. If the participant do not score at least 8 in the first 12 trials, an image is presented to inform that they will be going for the 2nd round of 12 trials. The current flow is set up like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/b/7/b775c1a0fcea4c031bb58f07f2baf2c9cde9ee4d.png)

In instr2, i have set up a code in the Each Frame tab and set continueRoutine = False, and only show when participants do not score at least 8 in the first 12 trials. The image shows, however it just freezes and does not proceed after to show the 2nd round of 12 trials. Here is my code.

> continueRoutine = False
> 
> if practiceLoop.thisTrialN == 11 and score \<= 5:  
> continueRoutine = True

Am i missing something out and that’s why it is not able to continue running?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 12, 2021, 5:49am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/2 "2021-04-12T05:49:53Z")

</div>

> [@psychisawesome](#):
>
> if practiceLoop.thisTrialN == 11 and score \<= 5:

How about the following in Begin Routine

```auto
if practiceLoop.thisTrialN == 11:
     if score > 5:
          practiceLoop.finished=True 
          continueRoutine = False 
else:
     continueRoutine=False 
     

```

---

<div class="post-metadata">

**Author:** ![psychisawesome](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@psychisawesome](https://discourse.psychopy.org/u/psychisawesome)\
**Post date:** [April 12, 2021, 7:47am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/3 "2021-04-12T07:47:43Z")

</div>

Hi! Thanks for your help. I shifted my logic to the Begin Routine tab and it works now!

---

<div class="post-metadata">

**Author:** ![psychisawesome](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@psychisawesome](https://discourse.psychopy.org/u/psychisawesome)\
**Post date:** [April 12, 2021, 2:09pm UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/4 "2021-04-12T14:09:47Z")

</div>

Hi! Thanks, that made it much better. I realised it should be in the Begin Routine instead of Each Frame which I previously did

---

<div class="post-metadata">

**Author:** ![psychisawesome](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@psychisawesome](https://discourse.psychopy.org/u/psychisawesome)\
**Post date:** [April 12, 2021, 2:19pm UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/5 "2021-04-12T14:19:26Z")

</div>

Hi sorry! I realised that even though I got 8 correct on the 12th trial, that routine continues when it is not supposed to. Did i miss something out?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 12, 2021, 6:27pm UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/6 "2021-04-12T18:27:19Z")

</div>

Why do you have 5 in the code?

---

<div class="post-metadata">

**Author:** ![psychisawesome](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@psychisawesome](https://discourse.psychopy.org/u/psychisawesome)\
**Post date:** [April 13, 2021, 1:12am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/7 "2021-04-13T01:12:23Z")

</div>

I only want the Instr2 to begin if participants do not score at least 8 on their 12th trial. So I

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 13, 2021, 5:55am UTC](https://discourse.psychopy.org/t/routine-does-not-continue/22211/8 "2021-04-13T05:55:29Z")

</div>

> [@psychisawesome](#):
>
> I only want the Instr2 to begin if participants do not score at least 8 on their 12th trial. So I

> [@psychisawesome](#):
>
> Hi sorry! I realised that even though I got 8 correct on the 12th trial, that routine continues when it is not supposed to. Did i miss something out?

These two statements are contradictory. Change the 5 in my code (which I copied from your code) to the largest failing score.
