Hello. I use builder for all the complicated stuff (i.e., creating stimuli, conditions list etc.), and do little modifications in coder.
I have an experiment that needs two successive responses in a row. I collect two successive responses for confidence rating. If participant is confident with their response they are required to press twice (on the same key). If they are not they can press once. There are 2 ways I can do this:
-
An option is that, I can have two different response components. In this case, I need to have a response interval for the first response (e.g. 3s~), and wait for the second response to continue with the next trial.
-
But I want to record the first response without a time limit, and have the second response to be in a response interval (1s~). This is what I fail to do. Psychopy (Builder or coder) does not give an error, but it also does not continue with the next trial. Here is the code that fails:
# *dotresponse* updates if frameN >= 0.0 and dotresponse.status == NOT_STARTED: # keep track of start time/frame for later dotresponse.tStart = t dotresponse.frameNStart = frameN # exact frame index dotresponse.status = STARTED # keyboard checking is just starting win.callOnFlip(dotresponse.clock.reset) # t=0 on next screen flip event.clearEvents(eventType='keyboard') if dotresponse.status == STARTED and frameN >= 120: dotresponse.status = STOPPED if dotresponse.status == STARTED: theseKeys = event.getKeys(keyList=['up', 'down']) # check for quit: if "escape" in theseKeys: endExpNow = True if len(theseKeys) > 0: # at least one key was pressed dotresponse.keys = theseKeys[-1] # just the last key pressed dotresponse.rt = dotresponse.clock.getTime() # was this 'correct'? if (dotresponse.keys == str(dotcorrect)) or (dotresponse.keys == dotcorrect): dotresponse.corr = 1 else: dotresponse.corr = 0 # *dotresponse2* updates if frameN >= 0 and dotresponse2.status == NOT_STARTED: # keep track of start time/frame for later dotresponse2.tStart = t dotresponse2.frameNStart = frameN # exact frame index dotresponse2.status = STARTED # keyboard checking is just starting win.callOnFlip(dotresponse2.clock.reset) # t=0 on next screen flip event.clearEvents(eventType='keyboard') if dotresponse2.status == STARTED: theseKeys = event.getKeys(keyList=['up', 'down']) # check for quit: if "escape" in theseKeys: endExpNow = True if len(theseKeys) > 0: # at least one key was pressed dotresponse2.keys = theseKeys[-1] # just the last key pressed dotresponse2.rt = dotresponse2.clock.getTime() # was this 'correct'? if (dotresponse2.keys == str(dotcorrect)) or (dotresponse2.keys == dotcorrect): dotresponse2.corr = 1 else: dotresponse2.corr = 0 # a response ends the routine continueRoutine = False
The part that causes the problem is here:
if dotresponse2.status == STARTED and frameN >= 75:
dotresponse2.status = STOPPED
If the first response is in interval of 75 frames it works fine. (It records the first response if the response is given within the 1 second. Then, it waits for the second response before moving to the next trial) So, I don’t understand why I cannot have the interval on the second response.
I would be grateful for any help you can offer!