Reply To: About timeouts

PennController for IBEX Forums Support About timeouts Reply To: About timeouts

#10800
Larissa_Cury
Participant

Hi,Jeremy! Thank you for this detailed answer, I REALLY appreciate it! Now I got it! So, I can say that the .stop() command makes the .wait() understand that the time has finished without waiting for the whol 5s, right? Now I got it! What about the feedback in the previous trial:

It should be: “If user presses the correctKey, show the ✅; if he/she presses the wrong key, ❌; in case of a timwout (5 seconds), show the timeout message ⏰

Is this the correct syntax? It seems to be working just fine, but I’m not 100% sure


getKey("answerKey") // Check for the correct key press or timeout
    .test.pressed(row.correctKey) // check keys (options are K and S)
    .success(      
        newText("Correct ✅").center().print(), // Display "Correct" message 
        newTimer('wait-positive-feedback', 500).start().wait() // Wait for positive feedback timer
    )
    .failure(
         getKey("answerKey").disable().test.pressed("K", "S")  // IF NEITHER K OR S was pressed, then display the timeout
        .failure(
            // Display "Timeout" message and wait for feedback timer
            newText("Timeout ⏰").center().print(),
            newTimer('wait-feedback', 500).start().wait()
        )
        .success(         // IF EITHER K OR S was pressed, then display the INCORRECT ANSWER IF IT DOENSN'T MATCH THE row.correctKey key
            newText("Incorrect ❌").center().print(),  // display negative feedback
            newTimer('wait-neg-feedback', 500).start().wait()   // Wait for negative feedback timer
        )
    )
 )