PennController for IBEX › Forums › Support › Behavioural task score › Reply To: Behavioural task score
May 15, 2020 at 12:58 pm
#5261
Keymaster
Hello,
The PennController counterparts of the if-else statements are the .test commands and their associated .success and .failure subcommands. You’ll also want to keep track of the score across trials, so you’ll need to use a global Var element:
Template("presentedWords.csv",
row =>
newTrial("recall",
newVar("score", 0).global() // Will initialize with 0 if Var doesn't exist yet
,
newText(row.item)
.print()
,
newText("In which condition of the experiment did you encounter this word?")
,
newText("Press the F KEY for INNER, the J KEY for OUTER, and the SPACEBAR for NEW WORD")
,
newKey("question1", "FJ ")
.log()
.wait()
.test.pressed( row.correctKey ) // Set value to v+1
.success( getVar("score").set(v=>v+1) )
,
newText("Your current score is: ")
.after( newText("").text(getVar("score")) )
.print()
,
newButton("Next").print().wait()
)
.log(row.item)
.log(row.list)
.log(row.condition)
)
Jeremy