on each trial of a fixation/visual stimulus task, I would like to deliver reward after a jittered delay, in order to prevent preparatory activity by the subject. I imagine others have needed this, so I am wondering if a solution already exists --
The two ways I imagined doing this were 1) delivering technically 2 pulses of reward, but with the 1st reward pulse duration = 0 ms, and the 'PauseTime' set to a jittered value, or 2) create a reward delay "scene" using the Timecounter adapter, with the timecounter.duration set to a jittered value, and run the reward delay scene only if the subject completed a trial successfully (that is, lh.Success = 1; see line 92 of attached code). The problem with the second method appears to be, that once the jittered value is set (line 29), it is used repeatedly for every trial.
Is there a way to either implement #1, or redefine the jittered delay variable of #2 on every trial? or pros/cons of either approach?
attaching code for clarity.