Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: jedione on May 25, 2019, 05:19:01 PM

Title: was music loop crash ever solved?" solved
Post by: jedione on May 25, 2019, 05:19:01 PM
was music loop crash ever solved?

cant seem to find,  any info...  but it happens when using..

kind of old topic...but still revalant :-\

after song ends...
Code: [Select]
local mysong = fe.add_sound("music/music-3.mp3");
mysong.loop = true;
mysong.playing = true;
Title: Re: was music loop crash ever solved?" solved
Post by: jedione on May 25, 2019, 05:23:44 PM
i new i  saw it somewere....

solved..... thought it would be nice to just be fixed

Code: [Select]
// [fe.sound.loop = true;] cause AM crash. I don't know the reason exactly. but, It works well as Plan B.
function playSound( path, loop=false ) {
local sound = fe.add_sound( path, true );
if( ! loop && ! sound.playing ) {
sound.playing = true;
}
if( loop ) {
fe.add_ticks_callback( this, "loopSound" )
}
function loopSound( ttime ) {
if( ! sound.playing ) {
sound.playing = true;
}
}
}
Title: Re: was music loop crash ever solved?" solved
Post by: kent79 on June 14, 2021, 03:07:20 PM
Thank you for your sharing. You help me a lot   :)