User:Jana Kamachi/MP3Player
string l1 = "Not playing anything"; string l2 = ""; string l3 = "Loading..."; string starter; integer current_track = 1; integer exists(string name){ if(llGetInventoryType(name) == -1) return FALSE; else return TRUE; } playback(){ if(exists(starter + "," + (string)current_track)){ //Get our sound ready. l1 = "Artist: " + llList2String(llCSV2List(starter),0); l2 = "Track: " + llList2String(llCSV2List(starter),1); llSetText(l1 + "\n" + l2,<1,0,1>,1); }else{ llSay(0,starter + "," + (string)current_track); llSay(0,"done"); llResetScript(); } llPlaySound(starter + "," + (string)current_track,1); if(exists(starter + "," + (string)(current_track+1))) llPreloadSound(starter + "," + (string)(current_track + 1)); current_track = current_track + 1; } default { state_entry(){ llSetSoundQueueing(TRUE); llListen(90,"",llGetOwner(),""); l3 = (string)llGetInventoryNumber(INVENTORY_SOUND) + " tracks."; } timer(){ llSetText(l1 + "\n" + l2,<1,0,1>,1); playback(); } changed(integer c){ if(c == CHANGED_INVENTORY) llResetScript(); } listen(integer c, string name, key id, string msg){ if(msg!="start"){ starter = msg; llSetTimerEvent(10); } } }