PennController for IBEX › Forums › Support › Conditionals/display logic › Reply To: Conditionals/display logic
Hi Laia,
Your first trial (“pretest”) shows a Scale element, immediately sets the Var element “tag1” to the currently selected value on the scale (ie. no value, since the participant hasn’t had time to make a choice yet) then prints the “go” button and wait for a click before moving on to the next trial
You second trial (“exp”) actually contains a fatal error, so it won’t be run, but if it were, it would check that the value of that Var element corresponds to the value of the variable oi
, which is not only undefined (as far as I can tell) but most importantly not declared: the script does not know what oi
refers to and crashes at that point, never creating the second trial nor executing any of the code that comes after that (ie. it doesn’t create the “end” trial either)
So you’ll want to switch the order of the last two lines of your first trial and add double quotes around oi
in the second trial:
newTrial("pretest", newScale("input_tag1", "eh", "no", "oi", "fa") .checkbox().log().vertical().print(), newButton("go", "Endavant") .print() .wait(), newVar("tag1").global().set(getScale("input_tag1")) ) newTrial("exp", getVar("tag1").test.is("oi").success( newText("instrus1", "You selected 'oi'!.") .print(), newButton("go", "Endavant") .print() .wait() ) )
If by “selecting at least oi” you mean selecting “oi” or “fa”, you can add a disjunct to your test:
getVar("tag1").test.is("oi").or( getVar("tag1").test.is("fa") ).success(
Jeremy