Reply To: Play sound after correct response

PennController for IBEX Forums Support Play sound after correct response Reply To: Play sound after correct response

#6045
Jeremy
Keymaster

Hi,

This worked for me—audio file’s just an example, and I hard-coded ArrowLeft as the correct answer, but you should be able to replace it with row.Correct_answer:

    newKey("pressOnArrow", "ArrowLeft", "ArrowRight")   
        .log("all")
        .callback( 
            getTimer("exposure").stop(),
            getTimer("timeout").stop()
        )
    ,
    newTimer("exposure", 300).start().wait() 
    ,
    getText("num").remove()
    ,
    getKey("pressOnArrow").test.pressed()
        .failure( newTimer("timeout", 5000).start().log().wait() )
    ,
    getKey("pressOnArrow")
        .disable()
        .test.pressed( "ArrowLeft" )
        .success( newAudio("https://upload.wikimedia.org/wikipedia/commons/3/35/Bongo_Agudo.ogg").play().wait() )

Let me know whether that helped fix the problem

Jeremy