TV Script

Expired

key     notecardID = NULL_KEY;
key     requestID;
integer lineNum;

default
{
  state_entry()
  {
    //Register ourselves
    llSay(1, (string)llGetOwner());
        
    //Start checking for emails
    llSetTimerEvent(10);
  }
    
  on_rez(integer start_params)
  {
    llResetScript();
  }
    
  timer()
  {
    //Read the notecard if we have one
    if (notecardID != NULL_KEY)
    {
      requestID = llGetNotecardLine(notecardID, lineNum);
    }
    //Check for email
    llGetNextEmail("", "");
  }
    
  email(string time, string address, string sub, 
        string message, integer num_left)
  {
    //We received an email detailing a new notecard
    //Stop displaying
    llSetTimerEvent(0);
        
    //Get the Notecard ID
    llWhisper(0, "Receiving Notecard: " + sub);
    notecardID = (key)sub;
        
    //If there are more emails in the queue
    //Get the next email
    if (num_left > 0)
    {
      llGetNextEmail("", "");
    }
    else //Else, start displaying textures from notecard
    {
      llSetTimerEvent(10);            
    }
  }
    
  dataserver(key requested, string data)
  {
    //Make sure this request was the one we made
    if (requested == requestID)
    {
      //Check to see if we are at the end of the notecard
      if ((data == EOF) || (data == ""))
      {
        //We hit the end of the file
        //Loop back to the beginning
        lineNum = 0;
        llGetNotecardLine(notecardID, lineNum);
      }
      else
      {
        //We successfully read the line
        //Set the texture using the UUID specified
        llWhisper(0, "Read Notecard Line#" + 
                     (string)lineNum);
        llSetTexture((key)data, ALL_SIDES);
        lineNum += 1;
      }
    }
  }
}

 

Random Sound

Expired

Just drop all the sounds you want into the prim and add this script.  It'll play random sounds. :D

// Soundname(s) = sound1
//                sound2
//                sound....

float   volume    = 0.25; //The volume used to play the sounds
float   frequency = 5.0;  //Percentage of the time to play a random sound
integer numSounds = 5;

playRandomSound()
{
    integer RandomNumber;
    
    //Generate a random number between 1 and 5
    RandomNumber = (integer)llFrand(numSounds) + 1;
    
    //Play a Cow Sound at the configured volume
    llPlaySound("Sound" + (string)RandomNumber, volume);    
}

default
{
    state_entry()
    {
        //Start the Timer
        llSetTimerEvent(1);
    }
    
    on_rez(integer start_param)
    {
        //Reset the Script when we rez the object from inventory
        llResetScript();
    }

    touch_start(integer total_number)
    {
        //Play a random sound for someone touching the object
        playRandomSound();
    }
    
    timer()
    {
        //Generate random number between 0 and 1, compare to frequency
        if (llFrand(1) <(frequency/100))
        {
            playRandomSound();
        }
    }
}

 

Loop Sound

Expired

All you need to do is drop in any sound you want to loop

default
{
    state_entry()
    {
        llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1);
    }
}

 

Radio Script

Expired

list stations = [ ]; // add station URLs here between the [ ] in quotes seperated by commas "url1", "url2", "url3"....
list station_descriptions = [ ];  // add station descriptions here between the [ ] in quotes seperated by commas... they should be in the same order as the urls they describe, you can use "" for any of them if you do not wish to add a description.
list djs = [ ];  // add the names of those authorized to change stations here between the [ ] in quotes seperated by commas
integer current_station = -1;

default
{
    state_entry()
    {
        current_station = -1;
    }

    on_rez(integer start_param)
    {
        llResetScript();
    }
    
    touch_start(integer total_number)
    {
        if(llListFindList(djs, (list)llKey2Name(llDetectedKey(0))) != -1)
        {
            current_station++;
            if(current_station >= llGetListLength(stations))
                current_station = 0;
            llSetTimerEvent(3);
            llWhisper(0, "Now Playing Station " + (string)current_station + ": " + llList2String(station_descriptions, current_station));
        }
    }
    
    timer()
    {
        llSetParcelMusicURL(llList2String(stations, current_station));
        llSetTimerEvent(0);
    }
}