I meant something like this
Where intr is skipped based on a variable skipIntr which is set in main based on the values of trials.thisN and repeats.thisN. If intr is to be skipped then repeats.finished=True will break out of that loop and move to the next trial.
I can’t help with your actual psyexp file however, because of the amount of AI generated code. You have a code component called JScode but the rest of your code is Python only implying that you don’t want to run the experiment online.
Builder isn’t Coder
I strongly discourage the use of PsychoPy Coder for the creation of psychology experiments because Builder is easier to debug, share with others and translate into PsychoJS for use online.
If you already have an experiment written in Coder, pasting the code into Builder code components is not sufficient to turn it into a Builder experiment. The logic of how to arrange an experiment is slightly different because of the way Builder works with components, routines and loops.
F…
Use Routine Settings
As of 2024.1.0, each standard routine includes its own settings, accessed by a cog in the top left.
[image]
Routine Settings includes five tabs: Basic, Flow, Window, Data and Testing.
So far I have mostly used the Flow tab to either add a duration to the routine or a “skip if” condition.
[image]
Routine durations are easier than adding durations to every component in the routine separately and works even when a component hasn’t been started because its start condition…
Own up to AI
When trying to help people on the forum or through consultancy we are experiencing an increase in the amount of idiosyncratic or opaque code, coming from novice programmers who. ChatGPT and other AI tools can be a great help with programming tasks but they are not experienced with the architecture of PsychoPy Builder. If you use them, please add a comment to your code along the lines of # Created using ChatGPT to create random pseudo-words. Adding your main prompts as comments might…
Use Auto → JS code components wherever possible
Even if you aren’t planning to run your experiment online, using an Auto code component will help you spot syntax errors in your Python code.
[image]
There are some cases where valid Python code comes up as a Syntax error on the JavaScript side but these are rare and, when you encounter then, you can switch to a Both code component and edit or delete the JavaScript side to highlight the fact that they contain code that won’t run online unedited. …