User:Cow Taurog/Sound looper

From Second Life Wiki
< User:Cow Taurog
Revision as of 21:57, 28 January 2012 by Cow Taurog (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script will continuously loop your choice of sounds dropped into it. Click to choose, click and hold to stop, menu responds to owner only. Up to 12 sounds are supported, more if you want to enhance the dialog menu on your own. <lsl> // This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License // // Commercial use is allowed. // Modification and/or distribution is allowed, as long as attribution for each revision is given, and the same license is used. // // Cow Taurog's sound looper, v1.0 // Drop this script, and up to 12 sounds that you want to loop into an object. // Click to choose the sound, click and hold to stop the sound. // The menu will automatically update when new sounds are added or removed, no reset or update is required on your part. integer giChan=882372; float gfHoldFor=2; integer giHold; list glItems; integer listen0; integer i; builditemlist(){ // Build a list of items in inventory

   glItems=[]; // Empty the old list
   integer j=llGetInventoryNumber(INVENTORY_SOUND); // Save the total number of objects
   for(i=0;i<j;i++){glItems+=[llGetInventoryName(INVENTORY_SOUND,i)];} // Store the items to the list

} default{

   on_rez(integer param){llResetScript();}
   touch_start(integer num){
   changed(integer change){if(change&CHANGED_INVENTORY){builditemlist();}}
   touch_end(integer num){if(giHold==FALSE){
           if(glItems!=[]){listen0=llListen(giChan,"","","");llDialog(llGetOwner(),"Pick a sound to loop...",glItems,giChan);}
           else{llOwnerSay("There aren't any sounds in this object to loop, drop some in first.");}
   listen(integer chan,string name,key id,string mess){if(id==llGetOwner()){

} </lsl>