Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Do not sell this; Karma knowz where you live ☠
- // How-to/Info:
- // Put this script with some sound clips (numbered so they play in order)
- // into a prim, then change the below values to suit your needs!!!
- // Example, change the sound_length to match how long your sound clips are
- float sound_length = 9.76;//How long the sound clips are
- float sound_volume = 1.0;//from 0.00 to 1.00
- float slow_server_adjustment = 0.00;//..
- float text_alpha = 0.5;//how visible floating text is, from 0.00 to 1.00
- vector text_color = <1,2,3>;//color of the floating text
- integer num_sounds;//how many sound clips
- integer active = FALSE;//Are we on/TRUE or off/FALSE
- //list sound_list;// not needed for this job
- loop_sounds(){
- integer sound;//first sound in the inventory
- for(; sound < num_sounds; ++sound){
- //llOwnerSay((string)sound + " - "+llGetInventoryName(INVENTORY_SOUND, sound));
- llTriggerSound(llGetInventoryName(INVENTORY_SOUND, sound), sound_volume);
- llSleep(sound_length);
- }
- }
- load_sounds(){
- integer sound;
- for(; sound < num_sounds; ++sound){
- string s = llGetInventoryName(INVENTORY_SOUND, sound);
- llSetText("• Preloading Sound • \n"+s, text_color, text_alpha);
- llPreloadSound(s);
- }llSetText(" ", text_color, text_alpha);
- }
- integer count_sounds(){
- integer i;
- integer n = llGetInventoryNumber(INVENTORY_SOUND);
- list result = [];
- for(i = 0; i < n; i++){
- result += [llGetInventoryName(INVENTORY_SOUND, i)];
- }//sound_list = result;
- return llGetListLength(result);
- }
- Play()
- {
- num_sounds = count_sounds();
- load_sounds();
- // llSetTimerEvent((num_sounds * sound_length)-(num_sounds * slow_server_adjustment));
- // llWhisper(0,"/me • Playing.");
- loop_sounds();
- }
- string help = "• Help / Usage •
- 1. Load sounds into the prim that has this script inside.
- 2. Open the script and find the \"sound_length\" value.
- 3. Change that value to match how your sound clips are.
- 4. Touch the object, wait for the sounds to preload.. Done!
- Note: Uncomment the line in the touch_event to make it \"owner only\".";
- default{
- //
- state_entry(){
- llSetText(" ", text_color, text_alpha);
- Play();
- }
- //
- changed(integer c){
- if(c & CHANGED_OWNER){
- llWhisper(0,"/me "+help);
- llResetScript();
- }
- else if(c & CHANGED_REGION_START)
- {
- llResetScript();
- }
- }
- //
- //on_rez(integer num_detected){
- touch_start(integer total_number){
- if(llDetectedKey(0) != llGetOwner())return;//uncomment for owner only
- active =! active;
- if(active){
- Play();
- }else{
- llSetTimerEvent(0.0);
- llWhisper(0,"/me • Stopped.");
- }
- }
- //
- timer(){
- loop_sounds();
- }
- //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement