Detect when track has finished

Hi, MZ question here:

Does anyone know if there's a way to detect when a BGM track has finished playing and to then play another bgm after that during a cutscene?
In this case, what I've got is a bgm intro on one track, then the rest of the bgm on a second track.The reason I've got them on two separate tracks is because I only want to hear the intro once, then the body of the bgm to play on loop. The original track is about an hour long and if I try putting that in there, it'll take up all the memory and slow down the game. So instead I just have a 7 second intro track, then the rest is just a 1 min track that'll repeat itself.
So, I want the intro to play only once, then the rest of the bgm to play on loop after that. But I don't want the player to be able to cause the intro to stop playing early because they were speedrunning through the cutscene.
What would be the simplest way to achieve this? Is there a script call or parallel event that could do it, or maybe a plugin?

I've been playing around with different methods.
One I tried is with parallel events. I tried one where it simply first played the intro, then the body of the intro. Didn't work, but i didn't expect it to. No music ended up playing.
I thought it might be because the engine was trying to play two tracks at once. So in between the two Play BGM commands, I put a wait command of 420 frames, the length of the intro track. When I tried that, the intro played, but then it just kept playing on repeat and wouldn't play the second track.
So then I tried putting the second track on a second event page. On the first page, I had the Play BGM command for the first track, then wait 420 frames, then Self Switch A. The second page is triggered by Self Switch A, which starts the next track. This is the closest I got. It switches between the two tracks. But there's a brief pause in between the two, which is too jarring. I want it to transition seamlessly between the two.

If anyone has any suggestions, pleae let me know.
The original track is about an hour long
Dear God.


I only want to hear the intro once
Have you considered looking into loop points? You realize RM supports meta data tags that can specify when a loop starts in the track and ends.


I have no idea if that's a good tutorial or something it, but a quick YouTube search for "rpg maker music loop points" came up with this.
Dear God.



Have you considered looking into loop points? You realize RM supports meta data tags that can specify when a loop starts in the track and ends.


I have no idea if that's a good tutorial or something it, but a quick YouTube search for "rpg maker music loop points" came up with this.

Interesting. I'll try that.
There's also a tutorial for looping BGM here:
Interesting. I'll try that.
As a quick note, if ever in the future you find yourself making something to absurd lengths or sizes (we had another user not so long ago make a background that was, at average DPI, would have been like 12 kilometers long) probably stop yourself and realize "this is probably not how you do this."
Glad you came here and asked about it.

A philosophy in programming to keep in mind that I think is relevant in many areas of life:
If you find yourself repeating the same code thing over and over again, you're probably doing something wrong.

Original thread: https://forums.rpgmakerweb.com/threads/detect-when-track-has-finished.171985/