Author Topic: Is there something to check for the loop ending?  (Read 918 times)

I am making a event to check if the loop ends and I am wondering if there is a code or a function to see if the loop ends. Is there one?

What loop? The programmer determines when the loop ends..

When the music on the music brick loop ends, I want to make an event to check it, I have the event functions and set, but I want to know if there is a function/code that checks for the loop ending.

Take a look at this from Elm's Land of Blocks client music.cs:
Code: [Select]
function clientCmdPlaySong(%song)
{
%length = alxGetWaveLen(%song.fileName);
if(isEventPending($lob::MusicRequestSched))
cancel($lob::MusicRequestSched);

if(alxIsPlaying($lob::CurrentSong))
{
lob_fadeMusicOut("",%song);
return true;
}

$lob::currentSong = alxPlay(%song);
$lob::MusicRequestSched = schedule(%length-200,0,lob_RequestNewSong);
}
I'm pretty sure theres no callback you can use, but you can get the songs length, then schedule an function to be called after that time.

(The important line is the last one)

EDIT: Actually, I'm not sure how helpful this is, as this is used with 2d music..
« Last Edit: May 06, 2013, 11:03:11 AM by boodals 2 »

That's not helpful at all

That's not helpful at all

It's better than not helping

you can get the songs length, then schedule an function to be called after that time.
You can do this, but it will be off because the music isn't synchronized between the client and server.

That's not helpful at all
instead of telling him it's not helpful, why don't you try to help him, unlike you, boodals is.

You can do this, but it will be off because the music isn't synchronized between the client and server.

Well if you stay in the same location then at least it will synchronize after the currently playing music loop ends. It's better than nothing.