I’m trying to create a program where every time a target stimulus is clicked on a reward appears briefly. The target stimulus (TS) is presented for 30 s so I would like the subject to press on the TS many times throughout the trial to get a reward. So far, using the code below, I am able to have the subject press on the TS and get one presentation of the reward. Unfortunately, after that reward disappears clicking on the TS no longer elicits it. Is there any way I can have the reward presented every time the TS is clicked on, without having to restart the trial, that way the TS will always be presented for 30 s?
while continueRoutine and routineTimer.getTime() > 0: # get current time t = trialClock.getTime() frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *Cue1* updates if t >= 0.0 and Cue1.status == NOT_STARTED: # keep track of start time/frame for later Cue1.tStart = t Cue1.frameNStart = frameN # exact frame index Cue1.setAutoDraw(True) frameRemains = 0.0 + 30.00- win.monitorFramePeriod * 0.75 # most of one frame period left if Cue1.status == STARTED and t >= frameRemains: Cue1.setAutoDraw(False) # *TargetStimulus* updates if t >= 0.0 and TargetStimulus.status == NOT_STARTED: # keep track of start time/frame for later TargetStimulus.tStart = t TargetStimulus.frameNStart = frameN # exact frame index TargetStimulus.setAutoDraw(True) frameRemains = 0.0 + 30.00- win.monitorFramePeriod * 0.75 # most of one frame period left if TargetStimulus.status == STARTED and t >= frameRemains: TargetStimulus.setAutoDraw(False) # *FoodResponse* updates if (mouse.isPressedIn(TargetStimulus)) and FoodResponse.status == NOT_STARTED: # keep track of start time/frame for later FoodResponse.tStart = t FoodResponse.frameNStart = frameN # exact frame index FoodResponse.setAutoDraw(True) if FoodResponse.status == STARTED and t >= (FoodResponse.tStart + 2): FoodResponse.setAutoDraw(False)