Loop jumps fast over first images and starts again afterwards

Hello,
my experiment (version 2022.2.4, builder) is almost finished but now, my loop does something I can’t explain to myself and there is no error message or anything conspicuous.

How does the loop work where the error occurs:


Every routine inside the (sequential!) loop shows an image, for the text_before_test, the show_test, and the comprehension_check you additionally have to react by mouseclick. Every routine has a code component that defines when a routine should be skipped or not. This works perfectly with exception of this topic’s error. Here is the code of the first routine (in begin routine):

//skip images
if (skip_image != 1) {
    continueRoutine = false;
    }

// log current trial
console.log('snaphot.thisN:' + snapshot.thisN);
console.log(comicImage);

Here is an image of my condition file:

Where is the error?
When entering the loop, the images of the first routine are not visible so the routine seems to start at the second routine (text_before_test), but in the console, I can see that they were shown. Once the second routine starts, everything is normal again, with the exception that at the first repetition of the loop, the loop starts at the very first image again. So everything is as it should be without that weird first run of the loop. I don’t get any error messages or warnings and I don’t know where to look anymore because everything seems fine.

What have I already tried and what do I want to achieve?
Closing and opening everything, uploading everything as a new experiment and changing the duration of the first routine inside the loop. I want that my loop follows sequentially my condition file again and that it starts with the first image and not with the recognition test without showing the image stimuli first.

I’m sorry that I don’t have a minimal example but since everything is in German and it’s a complicated experiment with a lot of background downloading of resources (not inside the loops, though!) that is difficult to achieve.

Thank you for your help!

If the image in the first routine is one loop behind (blank on first loop and then first image on second loop, etc) then that suggests that the image value is being updated after the image component has started.

How are you setting the image? Is it perhaps in a code component that is below the image component when it should be above?

Thank you for your answer! My code is above the image component, I attach some screenshots:

By coincidence, I found an odd solution to my problem: when setting a key_resp between the code component and the stimuli, the problem doesn’t occur. So now, I’ll have a secret key_resp that nobody will know of in the background :smiley: I found this by checking what I changed the last couple of days and the response type was one of the few things.