Unpacker On Rez (NewAge)

From Second Life Wiki
Revision as of 12:00, 21 July 2010 by Asia Snowfall (talk | contribs) (Created page with ''''NewAge Auto Unpacker v1.0''' Just copy and paste this script into your object that will contain your product and configure the few lines in // Configure; section <lsl> /////...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NewAge Auto Unpacker v1.0

Just copy and paste this script into your object that will contain your product and configure the few lines in // Configure; section

<lsl> ///////////////////////////////// // NewAge Auto Unpacker Script // By Asia Snowfall // Version 1.0 /////////////////////////////////

// Configure;

string Folder_Name = "New Folder"; // This will be the name of the folder sent to the user

string Show_Name_Of_Folder_On_Completion = "Yes"; // Change to No to not show the folder name when sent

string Show_Name_Message_On_Completion = "Folder will be named <folder>"; // If you have sent Show_Name_Of_Folder_On_Completion to Yes, change this message to however you want, Where you place the tag <folder> is where it will show folder name

string Message_On_Rez = "Sending your package now..."; // Message sent when object is rezzed

string Message_On_Sent_Completion = "Your package has been sent to you"; // Message sent when sending is complete

string Send_This_Script_To_Package_Owner = "yes"; // Change to yes if you want this script to be sent to the user within the package folder

string Delete_On_Completion = "Yes"; // Change to no if you don't want the object to delete itself after package is sent

///////////////////////////////// integer INVENTORY_TYPE = INVENTORY_ALL;


/////////////////////////////////

key llGetObjectOwner() {

   list details = llGetObjectDetails(llGetKey(), [OBJECT_OWNER]);
   return (key)llList2CSV(details);

}

llSendInventory(key id, integer inventory_type) {

   integer i = 0;
   integer items = llGetInventoryNumber(inventory_type);
   list to_send;
   string name;
   do
   {
       name = llGetInventoryName(inventory_type, i);
       if(llStringLength(name) > 0)
       {
           if(name == llGetScriptName() && llToLower(Send_This_Script_To_Package_Owner) == "yes")
           {
               to_send += name;
           }
           else if(name != llGetScriptName())
           {
               to_send += name;
           }
       }
   }while(i++<items);
   llGiveInventoryList(llGetObjectOwner(), Folder_Name, to_send);
   llInstantMessage(llGetObjectOwner(), Message_On_Sent_Completion);

}

default {

   on_rez(integer x)
   {
       llInstantMessage(llGetObjectOwner(), Message_On_Rez);
       llSendInventory(llGetObjectOwner(), INVENTORY_TYPE);
       if(llToLower(Show_Name_Of_Folder_On_Completion) == "yes")
       {
           integer index = llSubStringIndex(Show_Name_Message_On_Completion, "<folder>");
           string message;
           if(index != -1)
           {
               message = llDeleteSubString(Show_Name_Message_On_Completion, index, index + llStringLength(Show_Name_Message_On_Completion)-1);
               message += Folder_Name;
           }
           else
           {
               message = Show_Name_Message_On_Completion;
           }
           llInstantMessage(llGetObjectOwner(), message);
       }
       if(llToLower(Delete_On_Completion) == "yes")
       {
           llDie();
       }
   }

} </lsl>