PennController for IBEX › Forums › Support › Can we randomize time with newTimer() ? › Reply To: Can we randomize time with newTimer() ?
March 20, 2022 at 9:27 am
#7907
Participant
Dear Jeremy, I was able to take steps a and b, but I’m struggling with step c:
Template("tabela-target.csv" , row =>
newTrial("trial_2_center_cue_UP",
defaultText
.center()
.cssContainer({"position": "absolute",
"top": "50%",
"left": "50%",
"transform": "translate(-50%, +50%)"})
.print()
,
newText("D1", "<br><b>+</b>")
.cssContainer({
"font-size":"100px",
"color":"blue"})
.center()
.print()
,
newTimer("timer-D1",1000+Math.round(1600*Math.random())) // ------------------------------> my new random time between 400 and 1600 ms
.start()
.wait()
,
getText("D1")
.remove()
,
newText("cue", "<br> <b>*</b>")
.cssContainer({
"font-size":"100px",
"color":"green"})
.center()
.print()
,
newTimer("timer_cue_D2",100)
.start()
.wait()
,
getText("cue","D2")
.remove()
,
newText("D3", "<br> <b>+</b>")
.cssContainer({
"font-size":"100px",
"color":"pink"})
.center()
.print()
,
newTimer("timer_D3",400)
.start()
.wait()
,
getText("D3")
.remove()
,
newTimer("timer-RT",1700) // <-------------------------------------------- my new RT trial which imposes the answer within 1700 ms
.start()
,
newImage("imagens", row.imagem)
.size(500, 200)
,
newText("cruz_central", "<br> <b>+</b>")
.cssContainer({
"font-size":"100px",
"color":"black"})
.center()
.print()
,
//para cima//
newCanvas("center", 150,150)
.add( "center at 50%" , "center at 50%" , getImage("imagens"))
.cssContainer({
"position": "absolute",
"margin-top": "85px"})
.center()
.log()
.print()
,
newKey("keypress1","SK")
.log()
.callback( getTimer("timer-RT").stop())
,
getTimer("timer-RT").wait()
,
getKey("keypress1").disable(),
getText("cruz_central"),
getCanvas("center")
.remove()
,
newText("separacao", "<br> <b>+</b>") // <------------------------- this should be 3500 ms - timer-RT - timer-D1
.cssContainer({
"font-size":"100px",
"color":"yellow"})
.center()
.print()
,
newTimer("wait-separacao",2500)
.start()
.wait()
)
.log("imagens", row.imagem)
.log("item", row.versao)
);
I don’t see how putting “wait separação” before D1 would make it be: WAIT SEPARAÇÃO = 3500 MINUS timer-RT MINUS timer-D1 . Would you mind explaining it again, please?
Thanks in advance, as always!