Pause code does not work in online experiment

URL of the experiment: https://run.pavlovia.org/Mel499/animals_semantic-discrimination/html/?__pilotToken=d3d9446802a44259755d38e6d163e820&__oauthToken=8394ed62a7ad69a61ade176e43a234bdd243c0d84b15a7801ae4547fea1b738f

Description of the problem:

I designed the experiment with psychopy3 on my computer in the way that after half of the trials, there should be a short break. Therefore, within the “trials”-loop, I added a routine “pause” that should only occur if the number of trials is “150” (in total, there are 300 trials). I did this by adding the following code to the “Pause”-Routine (In the “Begin Routine” part):

if trials.thisN != 150:
continueRoutine = False

On my computer, this works perfectly fine and after 150 trials, the “Pause” Routine occurs once with the relevant text. However, if I try the experiment online on Pavlovia, the “Pause” Routine occurs after every single trial.

Do you have any idea why that is and how I could change it?

The URL to your experiment is not public so I cannot access it.
What you mention is a known issue when running experiments online since Auto-JS translation doesn’t seem to work in such cases. Could you please post your code component window to see how this is translated into JS?

Sure, this is the code component window:

I’ve tried to change the code type from Auto->Js to Js, but it still doesn’t work. Do you know which type of code would work in online experiments?

Try trials.thisTrialN instead of trials.thisN.

See here: "Take a break" works locally but not online

Thank you so much for your help!
In the end, it worked when I moved the code from the “begin routine” to the “every frame” window, as was suggested in the other discussion that you linked here.