Reply To: Can we randomize time with newTimer() ?

PennController for IBEX Forums Support Can we randomize time with newTimer() ? Reply To: Can we randomize time with newTimer() ?

#7895
Jeremy
Keymaster

The logic for average RT per trial is the same as average accuracy: add newVar("localRT").set(v=>Date.now()) above newKey("keypress1","SK") and below the wait command add getVar("localRT").set(v=>Date.now()-v) , newVar("practiceRTs",[]).global().set(v=>[...v,getVar("localRT").value])

Then your feedback trial would look like this:

newTrial("feedback",
  newVar("timeText").set( getVar("practiceRTs").global() ).set(v=> "You spent "+(v.reduce((n,m)=>n+m)/v.length)/1000+"s per trial on average" ),
  newText( "feedbackTime" ).text( getVar("timeText") ).print()
  ,
  newVar("accuracyText").set( getVar("accurate").global() ).set(v=> "You got "+v.filter(a=>a==true).length+" correct answers out of "+v.length ),
  newText( "feedbackAccuracy" ).text( getVar("accuracyText") ).print()
  ,
  newButton("Continue").print().wait()
)

Jeremy