Reply To: Stopping a timer

PennController for IBEX Forums Support Stopping a timer Reply To: Stopping a timer

#7293
sabrina
Participant

Hi Jeremy,

thank you very much for your fast and helpful reply, you’re really doing an amazing job here!

So this works indeed, but only after I removed all the unnecessary start and wait commands. Here is the code again, just in case anyone else needs it:

        // Cross, shown on screen for 1000ms
        newText("cross","<b>+</b>"),
        newTimer("crossTimer", 1000),                       
        getText("cross").remove()
        ,
        // Target letter, shown on screen for 500ms  
        newText("targetletter", row.targetletter),
        newTimer("targetletterTimer", 500),          
        getText("targetletter").remove()
        ,
         // Word, shown on screen for 500ms   
        newText("pseudoword",row.pseudoword),
        newTimer("pseudowordTimer", 500),          
        getText("pseudoword").remove()
        ,
        //Blank screen shown for 2000ms or until D or K is pressed
        newText("wait"," ").print(),
        newKey("stop early", "FJ").callback(getTimer("delay").stop()),
        newTimer("delay", 2000),
        getTimer("delay"),
        getText("wait").remove(),
        
        
        // 1000ms blank screen
        newFunction( ()=>$("body").css("background-color","pink") ).call(), //only for testing, can be removed
        newTimer("break", 1000), 
        newFunction( ()=>$("body").css("background-color","black") ).call() //only for testing, can be removed
    
        // End of trial, move to next one

Thanks again,
Sabrina