Who Is Online

3
Online

Friday, 19 October 2018 00:21

TV Station Script

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 < llGetListLength(teeVees); x += 1)
      {
        updateTV(x);
      }
    }
  }
}

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool