URL of experiment: practiceTask_online [PsychoPy]
Description of the problem:
I am trying to record the duration of time taken when participants imaging that they are copying a digit sequence with letters. Ideally, to begin responding, lctrl is pressed. To end the routine, lctrl or lshift is pressed again. It works on builder, but it freezes on the response screen online. I’ve followed the youtube tutorial by Jason Ozubko, and have tried various solutions I’ve found on the forum.
Here is the code for the beginning of the routine:
event.clearEvents('keyboard')
respKeys_imagery = []
key_press = 0
if expInfo['session'] == "baseline" or expInfo['session'] == "test" :
continueRoutine = True
else:
continueRoutine = False
Every frame:
if keyResp1_imagery.keys:
respKeys_imagery.append(respKeys_imagery.keys)
if(respKeys_imagery == 'lctrl'):
thisExp.addData("imageryStartTime", t)
event.clearEvents('keyboard')
elif(respKeys_imagery == ['lctrl', 'lshift']): # have also tried ['lctrl', 'lctrl']
thisExp.addData("imagerySubmitTime", t)
continueRoutine = False
I have also tried the following in every frame:
if keyResp1_imagery.keys:
if len(keyResp1_imagery.keys) == 1:
thisExp.addData("imageryStartTime", t)
event.clearEvents('keyboard')
elif len(keyResp1_imagery.keys) == 2:
thisExp.addData("imagerySubmitTime", t)
continueRoutine = False
I have set event as outlined by the crib sheet.
When I add two keyboard components, with lshift set to end the trial in the second component, the trial proceeds but I am able to proceed without pressing the first button to indicate starting the imagery, but I can’t figure out how to start the second keyboard on the condition that the first keyboard component has been completed (i.e., lctrl has been pressed).
Any help would be greatly appreciated!