| Reference | Downloads | Github

thisExp.nextEntry() doe not work in v3.0.2

Hi everyone,

I want to end a routine (involving text input to solve math problems) after a specified time. I used this code

if globalClock.getTime() - startTime >= 10:
    trials_math.finished = True
    continueRoutine = False

To avoid using two ‘continueRoutine = False’, I used this code for a ‘return’ response.

n= len(theseKeys)
i = 0
while i < n:

    if theseKeys[i] == 'return' and len(inputText) > 0:
        inputText = ''

The routine quits successfully after the time limit, however the loop does not work. When I press ‘enter’, the text I have just inputted disappears but the math problem is keeping the same. Here’s a screenshot of the setting of the text component

Does anyone know how to deal with this? Thanks a lot!


For anyone who might run into the same question. The problem is that I used a wrong trial name. I used this

if trials.thisTrialN == 0: # only on the first trial
    startTime = globalClock.getTime()

It should be like this

if trials_math.thisTrialN == 0: # only on the first trial
    startTime = globalClock.getTime()

Didn’t know ''trials" is the name of trials.

Alkso though, I’d strongly recommend you upgraded your installation. We’ve fixed a lot of bugs and made a lot of improvements (especially to timing) since 3.0.2

Will do, thanks!