psychopy.org | Reference | Downloads | Github

Finishing Loop that contains two Routines after a specific time regardless responses

OS (e.g. Win10):
PsychoPy version (e.g. v3.2.4.):
**Standard Standalone? yAUT01Forum.psyexp (23.9 KB)

**What are you trying to achieve?:
I want to do Alternative Uses Task. I want my loop (named Block) to stop after a certain amount of time regardless responses. My loop has two Routines: Word and then Vocalisation. Word has one text and one keyboard component. Vocalisation has one text and one keyboard component. Text and keyboard components always have 15s for time. I want my loop to finish when:

  1. The participant has not given a response at all during the Word Routine.
  2. The participant only get 180s in total for all the loop. For example, the participant went once through the loop, but then the participant when do for the second time Word Routine, it was already 180s so the loop finishes.

**What did you try to make it work?:

I have tried three forms:
First form:
Add to the Word Routine a code component:
To the Begin Routine*:

if Block.thisN == 0:
    leidy_timer = core.Clock()

To the Each Frame Tab*:

if globalClock.getTime() - leidy_timer.getTime() >= 30.0: #30 because I do not want try with 180s yet.
    Block.finished = True
    continueRoutine = False

–> What specifically went wrong when you tried that?:

No changes. it waits till I complete nResps $ 10 #I set 10 for making the script run but ideally the participant should be able to do the loop once or 100 of times. For me, only 180s is the important criteria for the loop to end.

Second Form

I add a code component to each of the Routines, and paste the following in
the Each Frame*:

if  t >= 30.0: #30 because I do not want try with 180s yet.
    continueRoutine = False
    Block.finished = True

–> What specifically went wrong when you tried that?:

No changes. it waits till I complete nResps $ 10 #I set 10 for making the script run but ideally the participant should be able to do the loop once or 100 of times. For me, only 180s is the important criteria for the loop to end.

Third Form

Add to the Word Routine a code component:
To the Each Frame*:

if globalClock.getTime() - t >= 30.0: #30 because I do not want try with 180s yet.
    Block.finished = True
    continueRoutine = False

–> What specifically went wrong when you tried that?:

It only starts to count for the time criteria when no-one has given a response.
If the participant does not give any response, it finishes the loop when coming back to the Word Routine. If the participants gives a response for the first loop, it continues to the second loop and it starts to count for the time criteria only when no-one has given a response.

Please helppp!
Thank you very very much for your time! excited about making this paradigm in Psychopy,
Leidy