Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: birenbergg on Mon 28/08/2017 15:37:12

Title: How to check if background music is already playing?
Post by: birenbergg on Mon 28/08/2017 15:37:12
Is there a way to check if the background music is playing, so it won't restart when the player enters the initial room?

Let's say I have an area with 5 rooms and the background music is shared between them. The player starts in room 1. When he changes to any other room, the music continues playing, but if he returns to room 1, the music restarts. That's not the effect I want.

I could use the event when the player enters the room for the first time, but what if the player quits then entire area and then would want to come back?
Title: Re: How to check if background music is already playing?
Post by: Mandle on Mon 28/08/2017 15:56:00
Yes, there is a command to check if an audio track is playing:

http://www.adventuregamestudio.co.uk/manual/ags47.htm

Scroll down to IsPlaying property.

(I found this by googling "AGS is audio playing"... Putting "AGS" in front of what you want to know and then a few words after is a quick shortcut I have found to find anything in the manual while avoiding its search option which is a bit hit-and-miss)
Title: Re: How to check if background music is already playing?
Post by: Khris on Mon 28/08/2017 17:36:33
Here's a custom function taking care of that: thread (http://www.adventuregamestudio.co.uk/forums/index.php?topic=50363.msg636486911#msg636486911)
Title: Re: How to check if background music is already playing?
Post by: birenbergg on Mon 28/08/2017 23:22:47
Thank you so much, guys!

P. S. Wish it was something that is handled natively.