--- alright I don't know how but I managed to solve it... after a minute I wrote this. And I had tried to solve this for days before posting..... I also can't see any delete button so this post will stay here aimlessly ---
Hi everyone.
I want to play a music in some rooms but if the music is playing before getting in the room, I don't want it to start over; instead I want it to keep playing. In the last version of AGS we were able to select room musics and it used to automaticly play room music if it wasn't playing and continue playing if it was playing. Now we don't have that property so I tried to write "xx.play();" in the room's load function, however, it played from start either if it was playing or not.
After that I tried coding, but I couldn't make it. I tried things like using if with "null" or "false", vs.
For now I use this as a workaraound but it is not perfect really:
function room_Load()
{
bluestone=aBlueStone_Cave.Play();
}
This is in the room which player starts.
function room_Load()
{
if(bluestone.IsPlaying==false){
bluestone=aBlueStone_Cave.Play();}
}
And this is in the other rooms with the same music. This works for now except when I go back to that first room, the music starts from beginning as expected. Also I didn't try to use another music in the game yet, so I don't know if it would cause any touble.
I beleive the problem has a simple solution because this is a basic need of a game. So I post this in the beginners forum. By the way, I read everything in the manual that is about audios, musics and sounds. I'm not saying I understood them all, though...
Did you solve it with that workaround you posted, or did you discover something else? It's something I'd really like to know too ???
At first I thought I solved but today when I tried it with rooms with different musics it didn't work. I tampered with audiochannel functions so I found things that would work. I put them all in a "if" so that it works now!
So, when I want the "aBlueStone_Cave" music to play but if it was playing before, not to restart; I write this in the room_load function:
if(music==null || !music.IsPlaying || music.PlayingClip != aBlueStone_Cave){
music=aBlueStone_Cave.Play();}
Just write what music you want instead of BlueStone_Cave and paste it in the room_load function. Or you can write another function for it, which won't be hard.