Allow me to volunteer my 'jukebox' code that I use in many projects:
function handle_music()
if music exist(1) = 1
if music playing(music) = 0
inc music
if music exist(music)
play music music
set music volume music, musicvol
else
music = 1
play music music
set music volume music, musicvol
endif
endif
endif
endfunction
You need to set two global values, music and musicvol. Load all your music with the load music command, starting with music number 1, set the music variable to 0 and set the musicvol variable to whatever you prefer from 0 to 100.
Now just call Handle_Music() within your main loop and you'll get jukebox-style play. As each song ends, the next will play, then the next, then the next, and when all of your music has played, it will go back to play the first one, and start through the playlist again.
You should be able to modify this simple function for any purpose.
EDIT: Just an afterthought; note the "if music exist(1)" condition right at the start. This is an error-catcher; if you haven't loaded any music at all, the function will skip all its code and return control straight back to your mainloop without doing anything, preventing the first music playing() command from crashing if there is no music loaded.