Reply To: log global vs. local variable

PennController for IBEX Forums Support log global vs. local variable Reply To: log global vs. local variable


Hello Peiyao,

Simply replace .settings.log() on your newVar elements with .global().set(0) and you’ll see the values reported at the end of all of the trial’s lines in the results file, without the cross-trial value contamination

However you never create a Var element named choice so the line .log( "selected", getVar("choice")) will always report undefined. If having the selection reported in the line corresponding to your Selector element is not enough and you want it to also appear on every other lines as well, you’ll have to create a dedicated Var element and set it accordingly. You normally should be able to set that Var element by referring to the Selector element directly, but there seems to be a bug with recent versions of PennController, so you’ll need to test the Selector and set each value manually:

// ...
    .add( getImage("1") , getImage("2") , getImage("3") , getImage("4"))
    .callback( getTimer("timeLimit").test.ended().success(getVar("slowClick").set(1)) )
    .test.selected(getImage('1')).success( getVar("selection").set(1) )
    .test.selected(getImage('2')).success( getVar("selection").set(2) )
    .test.selected(getImage('3')).success( getVar("selection").set(3) )
    .test.selected(getImage('4')).success( getVar("selection").set(4) )
// ...

Of course replace .log( "selected", getVar("choice")) with .log( "selected", getVar("selection")) (it’s better not to name two elements the same)

Let me know if you have questions