Reply To: Controller or Timer conditional

PennController for IBEX Forums Support Controller or Timer conditional Reply To: Controller or Timer conditional

#8121
Jeremy
Keymaster

Hi Erin,

There are two issues with the code above: 1) the Timer element is not started, so it will be waited for forever, and 2) there seems to be a bug in the callback command of the Controller element!

So you’ll need to work around the Controller element’s callback command. Here’s a suggestion, which consists in placing a wait command inside another callback command (this time, a bug-free one, called on a Timer element) so that wait does not block the main thread of execution:

newTrial("trial-1", 
    defaultText
        .center()
        .print()
    ,
    newAudio("llego-profesora", "La_profesora_llegó_a_la_clase_en_la.mp3")
        .play()
    ,
    newText("llego-profesora-t", "La profesora llegó a la clase en la momento preciso.")
        .center()
        .unfold(3650)
    ,
    getAudio("llego-profesora")
        .wait("first")
    ,
    newTimer("hurry", 3000).start()
    ,
    newTimer("dummy", 1)
        .callback(
            newController("AcceptabilityJudgment", {
                q: "¿Es esta oración aceptable?",
                s: "",
                as : ["SÍ", "NO"], 
                instructions : "Haz clic, SÍ o NO",
                presentAsScale : true,
                leftComment : "es aceptable",
                rightComment : "no es aceptable"
            })
                .center()
                .print()
                .log()
                .wait()
            ,
            getTimer("hurry").stop()
        )
        .start()
    ,
    getTimer("hurry").wait()
)

Jeremy