PennController for IBEX › Forums › Support › Conditional training phase › Reply To: Conditional training phase
November 25, 2020 at 1:24 pm
#6385
Jeremy
Keymaster
Hi Susanne,
You can increment a Var element upon success, check the value of that Var element at the beginning of your trials and only run them if it’s below 2. No need to resort to plain javascript:
Template("training.csv", row => newTrial("training", newVar("training_successes", 0) .global() .test.is( v => v > 2 ) .success( end() ) , newController("Maze", {s: row.Sentence, a: row.Distractor}) .css("font-size", "1.5em") .css("font-family", "Verdana") .print() .log() .wait() .remove() .test.passed() .failure( newText("<br/>oops!").css("font-size", "1.5em").css("color", "red").print() ) .success( getVar("training_successes").set( v => v+1 ), newText("<br/>great!").css("font-size", "1.5em").css("color", "green").print() ) , newTimer(500).start().wait() ) )
Let me know if you have questions
Jeremy