Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer numSounds;
- integer currSound;
- //settext is for debug
- regSound() {
- integer i;
- numSounds = llGetInventoryNumber(INVENTORY_SOUND);
- for(i=0;i <= numSounds;i++) {
- llPreloadSound(llGetInventoryName(INVENTORY_SOUND,i));
- llSetText("preloading " + (string) i + " of " + (string)numSounds, <1,1,1>,1);
- }
- }
- sleepTimer() {
- while(TRUE) {
- if(currSound < numSounds) {
- currSound++;
- llPlaySound(llGetInventoryName(INVENTORY_SOUND,currSound), 1);
- llSetText("Playing " + (string)currSound + " of " + (string)numSounds, <1,1,1>,1 );
- }
- else {
- restart();
- }
- llSleep(10);
- }
- }
- start() {
- //no sound queing because opensim doesn't support it, so it sounds like crap
- currSound = 0;
- string tm = llGetInventoryName(INVENTORY_SOUND,currSound);
- llSetText("Playing " + (string)currSound + " of " + (string)numSounds, <1,1,1>,1 );
- sleepTimer();
- }
- restart() {
- currSound = 0;
- llPlaySound(llGetInventoryName(INVENTORY_SOUND,currSound), 1);
- }
- default
- {
- state_entry()
- {
- regSound();
- start();
- }
- changed(integer p) {
- if(p & CHANGED_INVENTORY) {
- regSound();
- restart();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement