TV Station Script

Expired

list    teeVees;
integer listenID;
key     programID = NULL_KEY;

updateTV(integer number)
{
  //Scripts are delayed 20 seconds for each email
  if (programID != NULL_KEY)
  {
    llWhisper(0, "Sending Notcard: " + (string)programID);
    llEmail(llList2String(teeVees, number) + 
            "@lsl.secondlife.com", (string)programID, "");
  }
}
default
{
  state_entry()
  {
    listenID = llListen(1, "", NULL_KEY, "");
    llSetText(llGetObjectName(), <1 ,1,1>, 1);
  }
  
  on_rez(integer startup_param)
  {
    llResetScript();
  }
  
  listen(integer channel, string name,
         key id, string message)
  {
    if (llGetOwner() == (key)message)
    {
      //Only register if the new TV isn't
      //in the list of TVs
      if (llListFindList(teeVees, [id]) == -1)
      {
        llWhisper(0, "Registering TV: " + (string)id);
        teeVees += id; //Register TV in List
      }
      //Update the TV with the notecard
      updateTV(llGetListLength(teeVees) - 1);
    }
  }
    
  changed(integer change)
  {
    integer x;
        
    if (change == CHANGED_INVENTORY)
    {
      string notecardName = 
      llGetInventoryName(INVENTORY_NOTECARD, 0);
      llWhisper(0, "Processing Notecard: " + notecardName);
      programID = llGetInventoryKey(notecardName);
      llRemoveInventory(notecardName);

      //Loop through all the registered TVs
      for (x = 0; x 

 

Random Texture Switch

Expired

// Random Texture Switcher
// by Dackedidi Miles
float Timer = 1.2; // speed in seconds
//
//
default
{
   state_entry()
    {
            llSetTimerEvent(Timer);
    }
    
     timer()
    {
        integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
        float rand = llFrand(number);
        integer choice = (integer)rand;
        string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
        if (name != "")
            llSetTexture(name, ALL_SIDES);
    }
}

 

Texture Switch on Timer

Expired

// Texture Switcher
// by Dackedidi Miles
//
float Timer = 1.0; // speed in seconds
//
//
integer choice;
default
{
   state_entry()
    {
            llSetTimerEvent(Timer);
    }
    
     timer()
    {
        integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
        choice ++;
        if (choice == number)
            choice = 0;
            
        string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
        
        if (name != "")
            llSetTexture(name, ALL_SIDES);
    }
}

 

Texture Switch on Touch

Expired

default
{
  
     touch_start(integer total_number)
    {
        integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
        float rand = llFrand(number);
        integer choice = (integer)rand;
        string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
        if (name != "")
            llSetTexture(name, ALL_SIDES);
    }
}