Posted By: Loremaster
Why does this function not work? - 03/25/13 21:51
Code:
function playMusic() { if (event_type ==EVENT_SCAN && you==player) { //The Player entity has scanned me if (media_playing(nMusicHandle) == 0) { //Only play me if there is no music nMusicHandle = media_play(sMusicTitle, NULL, nMusicVol); } else { showDialog("Music Handler in use."); //DEBUG CONDITION } } }
It is supposed to start the function as soon as the player scans the object. If already a track is playing (handler > 0), none should be played. Actually it starts the track over and over again, playing it in dissonance as long as the player scans the object.
I can only imagine I use the condition wrong, but that's what I ttok from the manual.