Reply To: About timeouts

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

#10802
Larissa_Cury
Participant

Thanks for the quick response!! So, the logic is:

.success: ✅ : if the eow.correctKey was pressed
timeout ⏰: if NO KEY was pressed
error message ❌: if a key != from row.correctKey (already evaluated before) was pressed. Right?


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()  // => IF ANY KEY WAS PRESSED 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 A KEY != FROM row.correctKey was pressed, then display the INCORRECT
            newText("Incorrect ❌").center().print(),  // display negative feedback
            newTimer('wait-neg-feedback', 500).start().wait()   // Wait for negative feedback timer
        )
    )
 )