Hello,
It's already me again 😀
I am trying to improve a few things and now i on the sounds, musics parts.
Until now i was doing little tricks here and there to prevent music to start over again when reentering a room before the end of the music.
I found a thread on the forum here:
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/changing-rooms-without-the-music-starting-over/
I am trying to use the 2nd method with audio channels
In GlobalScipt.asc i have:
function game_start()
{
bool IsAudioClipPlaying(AudioClip* clip)
{
for (int i = 0; i < System.AudioChannelCount; i++)
{
if (System.AudioChannels[i].PlayingClip == clip)
{
return true; // found it
}
}
return false; // nowhere
}
}
In GlobalScript.ash i have:
import bool IsAudioClipPlaying(AudioClip* clip);
And finally in my room i have:
function room_AfterFadeIn()
{
if (!IsAudioClipPlaying(aMusic1))
{
aMusic1.Play();
}
}
Unfortunately it gives an error in the GlobalScript.asc
"GlobalScript.asc(13): Error (line 13): Nested functions not supported (you may have forgotten a closing brace)"
this is this line:
bool IsAudioClipPlaying(AudioClip* clip)
Can you please help me if you can see the mistake i made.
Thank you very much.
Quote from: actaria on Thu 07/03/2024 16:10:16Unfortunately it gives an error in the GlobalScript.asc
"GlobalScript.asc(13): Error (line 13): Nested functions not supported (you may have forgotten a closing brace)"
You put function IsAudioClipPlaying inside game_start. Put them separately instead.
Hello Crimson Wizard,
I did what you said and now it's perfectly working 👍
Once again thank you very much for your help
You can also take a look at this:
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/musicplayer/msg636660568/#msg636660568
(set up multiple tracks and have them play in specific rooms without restarting)
Hello Khris,
Playing tracks in specific room without restarting, this is really interesting !
I will have a look tonight, thank you for the link.
EDIT:
Couldn't resist to have a look at your link even if i am at work 😀 and i like it, it seems to be easy to use.
I will try your module as soon as i get home