dokitten

RenderWorks Unpacker With Landmark & Group 1.0 (Touch)

Apr 6th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////////////////////////////////////////////////////////////////////
  2. // RenderWorks Unpacker With Landmark & Group 1.0 (Touch) //////////
  3. ////////////////////////////////////////////////////////////////////
  4. // OpenSource Script For SecondLife and OpenSimulator //////////////
  5. // Licensed under Creative Commons Attribution 4.0 International ///
  6. ////////////////////////////////////////////////////////////////////
  7. // This script by RenderWorks may be used in any manner, modified //
  8. // and republished. Unless specified otherwise, our scripts are ////
  9. // always open source. Objects made with these scripts may be     //
  10. // sold with no restrictions. //////////////////////////////////////
  11. ////////////////////////////////////////////////////////////////////
  12.  
  13. string  rez_msg = "Thank you for purchasing! Please, Touch me, to unpack !"; // Message when rezzed.
  14. string  mnu_msg = "#Thank you for purchasing#\nPlease, select an option below:\n
  15. UNPACK: Get your file\n***GROUP: Get free gifts, previews, news ...";      // Message on the menu.
  16. string  unp_msg = "Unpacking, please wait..."; // Message when unpack button is pressed.
  17. string  upd_msg = "Finished unpacking!"; // Message when unpack button is pressed.
  18. string  grp_msg = "Click the following link to join our group:"; // Message before group link.
  19.  
  20.    key  grp_key = ""; // Group UUID.
  21.    
  22.    key  owner; // Key of the owner.
  23.  
  24. ////////////////////////////////////////////////////////////////////
  25.  
  26. default
  27. {
  28.     state_entry() // Script has started.
  29.     {
  30.         // Set the 'owner' value to the owner of the object.
  31.         owner = llGetOwner();
  32.        
  33.         // Say the rezzed message (rez_msg).
  34.         llOwnerSay(rez_msg);
  35.        
  36.         // Listen for messages
  37.         llListen(-2487,"",owner,"");
  38.     }
  39.  
  40. ////////////////////////////////////////////////////////////////////
  41.  
  42.     on_rez(integer r) // Object has been rezzed.
  43.     {
  44.         // Reset the script.
  45.         llResetScript();
  46.     }
  47.    
  48. ////////////////////////////////////////////////////////////////////
  49.  
  50.     touch_start(integer t) // Object was touched.
  51.     {
  52.         if(llDetectedKey(0) == llGetOwner()) // If the owner is the toucher.
  53.         {
  54.             // Open the menu.
  55.             llDialog(owner,"\n"+mnu_msg,["Unpack"],-2487);
  56.         }
  57.     }
  58.    
  59. ////////////////////////////////////////////////////////////////////
  60.  
  61.     listen(integer channel, string name, key id, string message) // Get messages from the menu.
  62.     {
  63.        
  64.         if(message == "Unpack") // If the message is 'unpack'.
  65.         {
  66.             // Say the begin unpack message (unp_msg).
  67.             llOwnerSay(unp_msg);
  68.            
  69.             // Remember the script name.
  70.             string  thisScript      = llGetScriptName();
  71.            
  72.             // Remember the items in the inventory.
  73.             list    inventoryItems;
  74.            
  75.             // The inventory item number.
  76.             integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
  77.            
  78.             // The current inventory item number.
  79.             integer index;
  80.            
  81.             for ( ; index < inventoryNumber; ++index ) // Process all inventory items.
  82.             {
  83.                 //Set 'itemName' to the inventory name.
  84.                 string itemName = llGetInventoryName(INVENTORY_ALL, index);
  85.  
  86.                 if (itemName != thisScript) // If the item name is not the name of this script.
  87.                 {
  88.                     if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY) // If the item is copyable.
  89.                     {
  90.                         //Continue processing.
  91.                         inventoryItems += itemName;
  92.                     }
  93.                 }
  94.             }
  95.            
  96.             // Give the inventory to the owner in a folder called the object's name.
  97.             llGiveInventoryList(owner, llGetObjectName(), inventoryItems);
  98.            
  99.             // Say the finished unpack message (upd_msg).
  100.             llOwnerSay(upd_msg);
  101.         }
  102.        
  103.  
  104.  
  105.         if(message == "Landmark") // If the message is 'Landmark'.
  106.         {
  107.             if(llGetInventoryName(INVENTORY_LANDMARK, 0)) // If a landmark exists.
  108.             {
  109.                
  110.                 // Give the inventory to the owner.
  111.                 llGiveInventory(owner, llGetInventoryName(INVENTORY_LANDMARK, 0));
  112.             }
  113.            
  114.             else // If there is no landmark.
  115.             {
  116.                 // Tell the owner there is no landmark.
  117.                 llOwnerSay("Sorry! I couldn't find the landmark to give you.");
  118.             }
  119.         }
  120.        
  121.  
  122.        
  123.         if(message == "Group") // If the message is 'Group'.
  124.         {
  125.             // Say the group message (grp_msg), followed by the group link.
  126.             llOwnerSay(grp_msg+" secondlife:///app/group/"+(string)grp_key+"/about");
  127.         }
  128.     }
  129. }
  130. ////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment