Conditional audio replay (n-back) and corresponding keyboard component not transferring well to pavlovia

Hi @jonathan.kominsky - thank you so much for your quick reply! I made the suggested update but unfortunately the result is the same as described in my previous post. I’ve tried to re-code this several ways now, and I get the same result every time.

It seems like the experiment will only progress through the routines via a key presses (not a code snippet declaring continueRoutine = false). Additionally, any audio starts either at the beginning of a routine or at a specific time (as told to by the sound component), not by anything written in a code snippet.

If I leave the condition element on “ding” blank, I get an error message. My coworker @fetch discussed this with @jon a few weeks ago here: frameDur is not defined error. However, putting a conditional variable into “ding” doesn’t work make the audio play. @jon, do you have any other suggestions to this problem?

The current experiment should be public here: https://gitlab.pavlovia.org/learningdevlab/v17_i_give_up (sorry for the name of the experiment - I named it in a moment of coding frustration)

    if ((repeat == "r") && (exposure_sound.psychoJS.STARTED == true))
        {
        let repeatedRespKeys = repeated_resp.getKeys();
        if (repeatedRespKeys[0] == 'y')
            {
            timetoDing = true;
            ding.play();
            ding.getDuration(2);
            continueRoutine = false;
            }
        }
    else if ((repeat !== "r") && (exposure_sound.psychoJS.STARTED == true))
        {
        timetoDing = false
        ding.status = PsychoJS.status.NOT_STARTED;
        continueRoutine = false;
        }