PennController for IBEX › Forums › Support › Can we randomize time with newTimer() ? › Reply To: Can we randomize time with newTimer() ?
March 28, 2022 at 5:37 pm
#7984
Keymaster
Hi,
Indeed, you won’t need to use the Var method now that you’ve fixed the EventTime issue in R
.log is not a global PennController command: you either call it on a PennController element or on the closing parenthesis of a newTrial command. In either case, .log comes immediately after a closing parenthesis (ignoring any space or linebreak character separating the parentehsis and the period). You get an error because you wrote .log after a comma, the way you would insert a reference to an element using newX or getX
This is how you would call .log on the closing parenthesis of newTrial:
newTrial("blocks-timer-trial",
newText("blocks-text","Espere...")
.cssContainer({
"font-size":"30px",
"position": "absolute",
"margin-top": "255px", //places it in the middle of the screen
"white-space": "nowrap"})
.center()
.print()
,
newTimer("blocks-text-timer",1500)
.start()
.wait()
,
getText("blocks-text").remove()
,
getVar("BLOCKS").global().set( v => Date.now() - v )
)
.log( "BlocksTimer" , getVar("BLOCKS") )
Jeremy