Time event freezes without reason after some time

Hello everyone !

So I'm trying to do a time system (not by myself, honestly, I was following a tutorial on youtube and tried to change it a bit because some parts were not what I wanted them to be) but it fails after a few time and freezes completely the game.

So I created a Time Common event, set to Parallel Process and with the Condition Switch 0021:Time (a switch automatically set to true once and for all at the beginning of the game).
So the time goes well, it increases until 5am and the color of the screen changes (so it becomes like dawn) and it keeps going until 7am. The problem is when it reaches 7am : it freezes completely, and the screen doesn't change anymore, I can't move, etc.

I tried with some Ruby Script to log and debug the thing, but it looks like the bug comes from the "wait" line, as my debug shows every line of log until the "FRAME WAIT" log line, just before the wait statement.
Here's the code, so it's clearer :
script1.PNG
script2.PNG
script3.PNG
script4.PNG


And here's the log just before the freeze :
console.PNG


And strangely, a few seconds after this log comes more lines :
console2.PNG

But it doesn't change much, it's still frozen, one new frame appears randomly sometimes...

Any idea where it may be coming from and why ?

Thanks a lot for your answers
I don't see anything wrong with the code. However, the 7 am is the only one that doesn't have Wait while tinting the screen. Maybe it helps.
Oh yeah, I removed it to see if it changed something. And yes it does, the game freezes and the screen never changes, it just tries forever and block here.

I don't see anything wrong either... and the music is still playing so I don't think the game has completely crashed. I just can't do anything.

EDIT : I see what's the problem : I had another Common Event interfering with this one when one switch were turned on : it was an old event I used for testing purposes and the ruby code into it was blocking the main thread and I forgot to remove it. It's solved now. Thanks for your help ^^
It sounds like you have an autorun that is being activated at 7 am. Check and see if you have any autoruns set to run when switch 22 is on, as that is probably what is going on.
@bgillisp Yeah I just found it out, thanks for your answer, sounds like the problem is solved !

EDIT : Is there a way to mark the thread as solved ?

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/time-event-freezes-without-reason-after-some-time.85447/