Reply To: suddenly: conditional never 'success'

PennController for IBEX Forums Bug Report suddenly: conditional never 'success' Reply To: suddenly: conditional never 'success'

#8255
Jeremy
Keymaster

Hello Daniela,

My apologies for the late reply. As far as I can tell, you don’t need to use any Var element in your code. You could do something like this instead:

// Top of your script
const YES_KEY = 'F', NO_KEY = 'J';

// inside your trial
newKey("rating", "FJ")
  .callback( getTimer("time_out1").stop() )
  .log("all")  
,
getTimer("time_out1").wait() // I added this here as it seems to make sense given the callback above
,
getKey("rating")
  .test.pressed( variable.match=='yes' ? YES_KEY : NO_KEY )
  .success(
    newText ("match_text", variable.prac_correct)  // print the CORRECT feedback response for this trial
      .css({"font-size":"20px","font-family":"times new roman"})
      .print("20vw","40vh")
  )
  .failure(
    newText ("mismatch_text", variable.prac_incorrect)  // print INCORRECT feedback
      .css({"font-size":"20px","font-family":"times new roman"})
      .color("red")
      .print("20vw","40vh")
  )
,
newText("spacebar", "Press the spacebar to continue.")
  .css({"font-size":"15px","font-family":"times new roman"})
  .italic()
  .center()
  .color("red")
  .print("20vw","50vh")
,
newKey("feedback", " ").wait()

Remember that you can always share your project’s demonstration link as a way to share your code and make troubleshooting easier

Jeremy