PennController for IBEX › Forums › Support › Cannot get the template function to loop over my experiment › Reply To: Cannot get the template function to loop over my experiment
April 13, 2023 at 5:39 am
#10449
Keymaster
Hi Xiangyu,
You cannot use a javascript function in that wait command: documentation, source code. Since that’s not supported, you cannot assume that this.keys will return a key that was pressed
Neither Ibex nor PennController define a global JavaScript log function. PennController has newTrial().log and element-specific log commands
If you want to add a column to the rows of this trial that will report whether the pressed key was correct, you can use a global Var element:
newTrial(
// ...
newVar("Correct", 0).global(),
// ...
newKey("keypress", "FJ")
.log()
.wait()
.test.pressed( variable.CorrectResponse ) // assuming that CorrectResponse in the table is either F or J
.success( getVar("Correct").set(1) )
,
// ...
)
.log( "CorrectResponse" , getVar("Correct") )
Jeremy