PennController for IBEX › Forums › Support › Can we randomize time with newTimer() ? › Reply To: Can we randomize time with newTimer() ?
March 14, 2022 at 2:23 pm
#7881
Keymaster
Hi Larissa,
a) See my answer on this thread
b) See the code in this message for an illustration of a timeout implementation. The basic idea is: start a Timer element, create (and print, if applicable) your interactive element and make sure to .log() it, wait for the Timer to elapse, then disable/remove the interactive element
c) Just set separacao to 3500 and start it before timer-D1, but only wait for it at the end of the trial, eg:
newTrial(
newText("instructions", "Quick! Press F or J now!").print()
,
newTimer("separacao", 3500)
,
newTimer("timer-D1", 1000+Math.round(600*Math.random()) ).start(),
newKey("FJ").log("all").callback( getTimer("timer-D1").stop() ),
getTimer("timer-D1").wait()
,
getKey("FJ").disable(),
getText("instructions").remove()
,
newText("Next trial incoming...").print(),
getTimer("separacao").wait()
)
Jeremy
-
This reply was modified 3 years, 7 months ago by
Jeremy. Reason: changed allottedtime for timer-D1