Need help counting consecutive turns

I’m trying to make a challenge room where the player has only a certain number of moves to find an object before they are removed from the room and need to try again. I created a scene and used the following code to define the ending.

Band Quest ends failure when the player has been in the band room for three turns.

It seems to work at first. However, upon entering the band room again to reattempt the challenge, the scene ending is immediately triggered. So it seems to count TOTAL turns that the player has been in the band room. How can I have Inform 7 count only consecutive turns, or reset each time the scene is started? Thanks!

Band Quest is a recurring scene.  Band Quest begins when the player is in the band room and Mr Thomas does not have the baton.  Band Quest ends failure when the player has been in the band room for three turns.  Band Quest ends success when the player has the baton.  Band Quest ends restart when the player is not in the band room.
When Band Quest begins:
	Say "Mr. Thomas [one of][or]once again [stopping]clears his throat and shouts, 'There you are! I've been looking all over for you!  Someone stole my baton and I need it back.  It needs to be in my hand before I count to three or else you need to get out of here!'";
When Band Quest ends success:
	Now Mr Thomas has the baton;
	Say "You hold up the baton to show Mr. Thomas and he smiles at you.  You feel all warm and fuzzy inside as he pats you on the head and says, 'Good job, little creature'!  This is the single greatest moment of your life.  As he reaches out to take the baton from your hand, a small gold key quietly falls from his pocket and lands inside the tuba case.  Mr. Thomas doesn't seem to notice - he's too busy snuggling his baton and repeating 'my precious' over and over.";
	Now the small gold key is in the tuba case;
When Band Quest ends failure:
	Say "'Time's up!', shouts Mr. Thomas from across the room.  The look in his eye tells you not to mess with him.  You quickly run back into the hallway.";
	Now the player is in the north hallway;
When Band Quest ends restart:
	Do nothing;
1 Like

This should work:

Band Quest ends failure when the time since Band Quest began is 3 minutes.

(Tweak appropriately if you’re not using the default time-passage rules).

NB this works because you already have the scene restart ending if the player leaves the band room – otherwise the failure would fire off 3 turns later even if the player has subsequently left and Mr Thomas is nowhere to be seen!

Awesome! It worked. Thank you!