Question about Loops

Hello!
Today I'm gonna ask a question about how to properly end a loop before it cancels / breaks; I'll try to explait it at my best:
I use a parallel event to show a bunch of images in sequece, within a loop, like an animation, while the main event goes on;
bandicam 2025-03-20 14-49-35-224.jpg

(you can ignore the "animation counter" variable changes, as it's something that I'm using now, but I want to get rid of)
after the player reach a certain point within the event, I want the loop to end, but I want it to reach the ending image before breaking (in this case to show picture 1 and hide picture 2), BUT with the "break loop" option / command, the loop ends abruptly whatever point it reached at the moment, without finishing properly...
Is there a way to solve tihs? A script command maybe? 😢
an loop in a parallel = BAD

because loop, loops 60 frames a seconds (without wait)
same as parallel, so NEVER ever use them together.

use just a parallel and use a control switch (by scriptcall the event selfswitch)
or by global switch to turn it ON or OFF.
an loop in a parallel = BAD

because loop, loops 60 frames a seconds (without wait)
same as parallel, so NEVER ever use them together.
Nonsense, a loop is perfectly OK here. See the Move Pictures all have (Wait) on them? And there's a Wait 30 frames in there? And there's a startup bit that shouldn't loop?

A loop in any event is bad if there are no waits inside it, because it will repeat indefinitely as fast as it can. With suitable wait times, a loop enclosing the entire event is, at worst, redundant in a Parallel or Autorun event.

after the player reach a certain point within the event, I want the loop to end, but I want it to reach the ending image before breaking (in this case to show picture 1 and hide picture 2), BUT with the "break loop" option / command, the loop ends abruptly whatever point it reached at the moment, without finishing properly...
When the event changes page, that ends the Parallel event immediately. That is what is immediately ending your loop.

You could move the commands that end the sequence to another place, e.g. maybe add "Show Picture 1, Erase Picture 2" to the page that activates after the Parallel event ends, or to the event that causes this one to change its page?
Nonsense, a loop is perfectly OK here. See the Move Pictures all have (Wait) on them? And there's a Wait 30 frames in there? And there's a startup bit that shouldn't loop?

A loop in any event is bad if there are no waits inside it, because it will repeat indefinitely as fast as it can. With suitable wait times, a loop enclosing the entire event is, at worst, redundant in a Parallel or Autorun event.


When the event changes page, that ends the Parallel event immediately. That is what is immediately ending your loop.

You could move the commands that end the sequence to another place, e.g. maybe add "Show Picture 1, Erase Picture 2" to the page that activates after the Parallel event ends, or to the event that causes this one to change its page?
As of now, I'm using that "animation counter" variable as a sort of marker, to know exactly what image is being shown (in the example image I posted there are only 2, but sometimes the sequence go over a dozen of images, which makes things a bit difficult), so that I can end the sequence properly within the main event page with a conditional branch based on the animation counter variable:
like
"If animation counter is 1 do XYZ"
"If animation counter is 2 do YZ"
"If animation counter is 3 do Z"
Untill reaching the end of the sequence, but that adds a LOT of strings to the main page...
I know, that's a Super complicated and probably messy way to do it, but it's the only way I was able to come up with my limited knowledge
It would be way better if there is a way to achieve a "reach the end of the loop and end it"
BUT with the "break loop" option / command, the loop ends abruptly whatever point it reached at the moment, without finishing properly...
You didn't post how do you break the loop.
1742480882036.png

Normally you check a switch and break the loop at the very end of it (before repeat above).
But keep in mind parallel even loop by themselves so after the loop breaks, it will start from the first line again. You need to erase or change to another page after the loop.
You didn't post how do you break the loop.
View attachment 335092
Normally you check a switch and break the loop at the very end of it (before repeat above).
But keep in mind parallel even loop by themselves so after the loop breaks, it will start from the first line again. You need to erase or change to another page after the loop.
So, you're suggesting I do something like this?
bandicam 2025-03-20 16-00-23-037.jpg


While within the main event I put this to break the loop (by turning the paralled event self switch off)
bandicam 2025-03-20 16-05-07-092.jpg


I can't find the "repeat above" option tho..?
Why so complicated? Just change the switch in your main event.
1742485519998.png
Why so complicated? Just change the switch in your main event.
View attachment 335099
LOL, I didn't realize the image you posted in the previous post was a cropped loop.
Cough, anyway, it seems to work!
Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/question-about-loops.176407/