Hello!
I am trying to design a task where a routine would end after x mouse clicks in an image.
The number of mouse clicks would be different in each condition (excel file).
My only problem is setting the number of clicks in the code component and making it work.
OK so I am almost there, here is something in my code component:
if mouse.isPressedIn (blk1) and len(mouse.clicked_name) >= len(sequence1):
continueRoutine = False
elif mouse.isPressedIn (blk2) and len(mouse.clicked_name) >= len(sequence2):
continueRoutine = False
blk1 and blk2 are my objects to be clicked
sequence1 and sequence2 are numbers of times the objects have to be clicked to end the routine (in an attached excel file)
It works. Kind of.
The problem is: if sequence1= 5 clicks and sequence2=2 clicks, if I click once on blk2, I just need to click 4 times on blk1. The number of clicks are added.
The problem must be in ‘’’ len(mouse.clicked_name) ‘’’ but I am unable to solve it. Thanks again for your help.
mouse.clicked_name is a Python list of names like ['blk1', 'blk1', 'blk2'] if they pressed those buttons in that order. Python lists have a method called count().