Need help tracking time with a common event + parallel process

Hi all! I'm attempting to create a common event that tracks intervals of time, and I'm having trouble getting the event set up properly.

commonevent.PNG

This is how I've set up the basis for the common event. I set up a loop that adds 1 to a variable every time a second has passed. After 5 seconds have passed, I've set up a conditional branch to break this loop, in order to create 5 second intervals (I don't actually want it to stay as 5 seconds--I set it as 5 seconds to make it easy to playtest, which is why I've set it up like this instead of just using a wait command).

However, once it reaches 5 seconds, it doesn't break the loop. I set up another event that tells me what number the seconds variable is set to, and it just keeps going and continues to count past 5. I'm not sure what I'm doing wrong here.
Use this in one variable when you start:
1699819994100.png

Then do the same in a second variable when you want to check the time, then do \v[2] - \v[1] and you have the time past in seconds.


Your way works, but it keeps looping because you don't deactivate the parallel event. A parallel event wil run till you stop it. (turn off the switch)
Your event isn't constructed correctly.

Autorun and parallel events automatically repeat themselves - there's no reason to put a loop inside of one. All the break command is doing is breaking the loop so that it gets to the bottom line of the event and starts over.

Get rid of the loop and, instead, turn off the switch that's making the event active (#102 met alg).
first, get rid of the loop command.
all parallel processes automatically loop, and creating a loop inside a loop would only cause timing errors.

and that is also why it doesn't stop - it DOES break the loop, just to reenter it in the next parallel process frame.

for a correct time parallel, you keep counting and use multiple variables for second, minute and so on, checking to count the minute after sixty in seconds, the hour after sixty in minutes and so on.
Your event isn't constructed correctly.

Autorun and parallel events automatically repeat themselves - there's no reason to put a loop inside of one. All the break command is doing is breaking the loop so that it gets to the bottom line of the event and starts over.

Get rid of the loop and, instead, turn off the switch that's making the event active (#102 met alg).
Thank you, that worked! I knew I was forgetting something.
Just for your info:

A loop in a parallel is fine, in many cases, though. If you want something to happen when your timer hits 5, you break the loop and do what comes after next. Or if you need to do something at the start, like resetting the timer.

It is only because there is nothing before or after the loop that the loop isn't needed.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-tracking-time-with-a-common-event-parallel-process.162871/