If no response is given, beep sound generated after 30seconds

I am using Psychopy2 and I already coded the entire Psychomotor vigilance task, however I want to code the following:

Within the trial loop, I want to set a condition where if the participant hasn’t responded within 30seconds after stimulus presentation, a beep sound will be generated. I already got the beep sound from using winsound, but I cannot for the life of me code the loop for the timer. After the sound (whose purpose is only to alert the participant if distracted) the activity should continue and the participant should give a response.

so it would look something like this:

if response < 30seconds
if no response == 30 seconds
play beep sound

I used an if statement but I am aware that we would have to use a loop so that it would keep on looking at the time passed continuously.

How do you think it would be best? Sorry for the lack of code, do not have access to it at the moment, but if needed will add it tomorrow.

Hi @cat500, are you using Coder or Builder to create your task?