How to play and repeat stimuli after manual click?

@HungShao, yes in this instance this is happening because mouse.getPressed() records when a mouse button is clicked, not the current state of the mouse. So, after clicking the right mouse button, the play condition is always true and then the sound is continually played. An easy fix is to reset the mouse button after each right mouse button click. This is not necessarily the recommended way, however I do not see any other working method for resetting mouse clicks online:

if ((mouse.getPressed()[2] !== 0)) {
    beep.play();
    psychoJS.eventManager.getMouseInfo().buttons.pressed = [0,0,0]
}
    
1 Like