Routine responses and image not timing correctly

Hello,

I’m having trouble timing a routine’s image and number of responses to be in sync. The routine showing an image is supposed to only last 20 seconds and participants are supposed to input key responses as much as they can in those 20 seconds (there are 32 correct inputs total). However, when I run the experiment, the image stays over 20 seconds and waits for 32 inputs to be put in.

In Builder, I set the duration for the image for 20 seconds, the keyboard responses have infinite duration, and there are 32 repetitions for the loop.

I thought it could be the number of repetitions, but when I set it to 1, the routine automatically ends when only 1 input is put in (without inputs put in, oddly enough, the image stayed up for 20 seconds).

I’m new to PsychoPy and coding, so I’m not sure how to input a custom code to fix this.

You need to specify a duration of 20 s for the keyboard component as well, and set it to “store all keys” to allow for collecting multiple responses.

It sounds like you don’t want a loop at all, but to have a single routine being shown once, for 20 s.

You need to describe to us how you want to manage the responses. i.e. what should happen when a person exceeds 32 within 20 s? What happens if there are fewer than 32? etc

At this stage, we don’t really know anything about your design though. Does one image and up to 32 responses constitute a single trial? Or will you be looking at individual responses? It might be that using a loop is the way to go, but it would take some custom code to ensure that the total duration does not exceed 20 s.