Description of the problem:

Objects Locations task, present one object one screen at a time;

I have the following learning criteria i’m trying to set -

if a participant places an object within 150 pix then its correct;

if they get an object correct twice in a row then it skips over this;

loop finishes when all objects placed correctly twice in a row;

Participants are given feedback each time.

I’ve included this as “online” because I had a version of it that worked but it never translated well with js.

this is what I have now as a code component:

Begin Exp:

`obs_dict = {}`

Begin Routine:

```
if obs_dict == {}:
for image in trials.trialList:
image = image['object']
obs_dict[image] = 0
correct = False
xloc = trials.thisTrial['xloc']
yloc = trials.thisTrial['yloc']
image = trials.thisTrial['object']
if obs_dict[image] == 2:
skipThisTrial = True # variable to use in feedback etc
continueRoutine = False # end this routine
if 0 not in obs_dict.values() and 1 not in obs_dict.values():
# end the whole trials loop
trials.finished = True
else:
skipThisTrial = False
```

End Routine:

```
if mouse.x[0] in range(xloc-150, xloc+150):
if mouse.y[0] in range(yloc-150, yloc+150):
correct = True
if correct == True:
obs_dict[image] +=1
elif correct == False and obs_dict[image] == 1:
obs_dict[image] = 0
```

And in my feedback routine (Every frame):

```
if skipThisTrial:
continueRoutine = False
```

here’s the builder structure:

and my conditions:

**i’ve tested that the obs_dict is updating as it should and getting correct/incorrect and these seem to work -

**Key problem - the loop always stops after 40 trials (2 loops) whether correct or incorrect**

This is the last step of my online study so if someone can get me over the line i’d massively appreciate it.

Cheers,

Tom