IsMusicIDLoaded(n)

Feature requests for future versions of Hollywood can be voiced here
Post Reply
Bugala
Posts: 1395
Joined: Sun Feb 14, 2010 7:11 pm

IsMusicIDLoaded(n)

Post by Bugala »

I just noticed there is no way to check if some specific music ID is actually loaded or not.

This isn't a big deal, but I have this very simple function, which is part of Music related functions:

Code: Select all

Function p_Music.Stop()
StopMusic(1)
EndFunction
However, I just realized there can come a situation where this p_Music.Stop() is called before any music is loaded, which crashes it.

So I started Looking for something like IsMusicIDLoaded, but couldn't find one.

This means that either I have to load some music into ID 1 myself, even I never play it, or I have to have some sort of Variable which keeps info whether this ID 1 is occupied or not, and then check it before using StopMusic(1).

Would be handy to have something like IsMusicIDLoaded(n)
Flinx
Posts: 350
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: IsMusicIDLoaded(n)

Post by Flinx »

This is the begin of my Stop function:

Code: Select all

Function p_StopMusic(m)
	If HaveObject(#MUSIC, m)
		If IsMusicPlaying(m) Then StopMusic(m)
Bugala
Posts: 1395
Joined: Sun Feb 14, 2010 7:11 pm

Re: IsMusicIDLoaded(n)

Post by Bugala »

Thanks! I didn't realize such a thing already existed.
Post Reply