> On 10/04/2015, at 11:49, Barb Lahey <barbla...@gmail.com
> Also, I do not know if it is worth noting, that while I am trying to code this into a routine, I would like it to stay present for the duration of the Loop, and as the 5 minutes ends, the Loop should end.
If I have this right, you want a loop that will last for exactly 5 minutes, which encompasses multiple repetitions of a routine, each relatively brief, but regardless of which trial you are on, there is a timer which seamlessly and continuously counts down from 5 minutes?
If so (this is all untested, so expect errors):
Insert a Code component in the trial routine. In its "Begin Experiment" tab, put:
countdownStarted = False
In its "Begin Routine" tab, put:
if not countdownStarted:
countdownClock = core.CountdownTimer(300) # 300 s = 5 minutes
countdownStarted = True
In its "Each frame" tab, put:
timeRemaining = countdownClock.getTime()
if timeRemaining <= 0.0:
continueRoutine = False # end this trial immediately
nameOfYourLoop.finished = True # and terminate the loop (use its actual name)
countdownStarted = False # only necessary if you'll be using the countdown again elsewhere
minutes = int(timeRemaining/60.0) # the integer number of minutes
seconds = int(timeRemaining - (minutes * 60.0))
timeText = str(minutes) + ':' + str(seconds) # create a string of characters representing the time
Then in your text component, simply put this in the text field:
Ensure that the code component is above the text component in the Builder GUI. That way, the text component will receive the current value of timeText on each screen refresh.
Hope that helps,