PennController for IBEX › Forums › Support › Can we randomize time with newTimer() ? › Reply To: Can we randomize time with newTimer() ?
March 21, 2022 at 6:14 pm
#7941
Larissa_Cury
Participant
That’s what I’ve done so far:
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() , timerd1duration = 400+Math.round(1200*Math.random()) , newTimer("timer-D1",timerd1duration) .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() , newVar("newTimerDuration").set( v=>Date.now() ) , newTimer("timer-RT",1700) .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() , getVar("newTimerDuration").set( v=> 3500 - timerd1duration - (Date.now()-v) ) , newTimer("wait-separacao").set( getVar("newTimerDuration") ) .start() , getKey("keypress1").disable(), getText("cruz_central"), getCanvas("center") .remove() , newText("separacao", "<br> <b>+</b>") .cssContainer({ "font-size":"100px", "color":"yellow"}) .center() .print() , getTimer("wait-separacao") .wait() ) .log("imagens", row.imagem) .log("item", row.versao) );
that’s the error I get = Invalid duration for Timer “wait-separacao” (newTrial: 47)…What should I do?
- This reply was modified 2 years, 6 months ago by Larissa_Cury. Reason: include information
- This reply was modified 2 years, 6 months ago by Larissa_Cury. Reason: add information