OS (e.g. Win10): Windows 11
PsychoPy version (e.g. 1.84.x): v2023.2.3
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I am trying to repeat a sound component infinitely with a mouse component without creating a loop (because I also have a scale component).
What did you try to make it work?:
I tried to add this code component, but it does not seem to work:
#Begin routine
sound_started = False
#Each frame
if mouse_stim1.getPressed()[0]: # Check if the left mouse button is pressed
if not sound_started: # Play the sound only if it hasn't started yet
reduced_variant.play()
sound_started = True
else:
sound_started = False # Reset the flag when the mouse button is released
My experiment contains the following:
What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.
The issue is, I don’t get any error and I sometimes feel that the code is not executing… In any case, the code is not applied.