Randomly pick up an image from a big pool of images all belonging to a condition

I’m wondering if this is an ordering issue. I don’t know much about how a lot of the ordering of loop operations goes on behind the scenes, but one possible cause of your problem would be if in PsychoJS the primeloop.thisRepN is being incremented before your custom code snippet runs.
If you want to always end the primeloop after 1 run, why not try making the conditional statement more inclusive, so try doing

if primeloop.thisN >= 0:
    trials.finished=True

and it should translate to

if ((primeloop.thisRepN >= 0)){
    trials.finished=true;
}

That might not solve it, but it follows the approach of trying the easy fixes first that don’t require any major configuration changes of your task, and if that doesn’t work we can always try more complex edits later.

1 Like