I don't know if it can help, but I have a few scripts examples that may work.@maxman , i will have to check this out. There are some other threads that meniton somtheing along the lines that a music stream can be paused & the position where it was can be "saved"
problem with this is that if your game crashes, the music "bookmark" wont be saved
so the next best thing is to have a script that goes like this:
if current stage music equals none (nothing is playing) then start playing music xxx.ogg from position xxx loop value yyyy
if music playing equals level4.ogg, then do nothing
void musicPlay(void music, int loop)
{//Play defined music
void mStyle = getglobalvar("musicStyle");
void folder;
//GET CURRENT MUSIC STYLE
if(mStyle == "custom"){folder = "Musics/";}else{folder = "Data/music/"+mStyle+"/";}
//SET LOOP TO ZERO IF NULL
if(loop == NULL()){loop = 0;}
//PLAY MUSIC
playmusic(folder+music, loop);
setglobalvar("musicPlaying", music);
}
void musicReplay()
{//Replay the current music if the style is changed in-game
void music = getglobalvar("musicPlaying");
if(music != NULL()){
if(openborvariant("in_level")){musicPlay(music, 1);}
}
}
void musicPlay(void music, int loop, float offset)
{//Play defined music
void mStyle = getglobalvar("musicStyle");
void folder;
//GET CURRENT MUSIC STYLE
if(mStyle == "custom"){folder = "Musics/";}else{folder = "Data/music/"+mStyle+"/";}
//SET LOOP TO ZERO IF NULL
if(loop == NULL()){loop = 0;}
//PLAY MUSIC
playmusic(folder+music, loop, offset);
setglobalvar("musicPlaying", music);
}
@maxman@Kratus How about declaring an offset for playmusic? Would it be like this?
Code:void musicPlay(void music, int loop, float offset) {//Play defined music void mStyle = getglobalvar("musicStyle"); void folder; //GET CURRENT MUSIC STYLE if(mStyle == "custom"){folder = "Musics/";}else{folder = "Data/music/"+mStyle+"/";} //SET LOOP TO ZERO IF NULL if(loop == NULL()){loop = 0;} //PLAY MUSIC playmusic(folder+music, loop, offset); setglobalvar("musicPlaying", music); }
I might be wrong about it since I don't know where it could be declared with or without globalvar for looping to certain part instead of going back to the very beginning.


