dokitten icon

RenderWorks Unpacker With Landmark & Group 1.0 (Touch)

dokitten | PRO | 04/06/18 01:25:31 PM UTC | 0 ⭐ | 8422 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

////////////////////////////////////////////////////////////////////
// RenderWorks Unpacker With Landmark & Group 1.0 (Touch) //////////
////////////////////////////////////////////////////////////////////
// OpenSource Script For SecondLife and OpenSimulator //////////////
// Licensed under Creative Commons Attribution 4.0 International ///
////////////////////////////////////////////////////////////////////
// This script by RenderWorks may be used in any manner, modified //
// and republished. Unless specified otherwise, our scripts are ////
// always open source. Objects made with these scripts may be     //
// sold with no restrictions. //////////////////////////////////////
////////////////////////////////////////////////////////////////////
 
string  rez_msg = "Thank you for purchasing! Please, Touch me, to unpack !"; // Message when rezzed.
string  mnu_msg = "#Thank you for purchasing#\nPlease, select an option below:\n
UNPACK: Get your file\n***GROUP: Get free gifts, previews, news ...";      // Message on the menu.
string  unp_msg = "Unpacking, please wait..."; // Message when unpack button is pressed.
string  upd_msg = "Finished unpacking!"; // Message when unpack button is pressed.
string  grp_msg = "Click the following link to join our group:"; // Message before group link.
 
   key  grp_key = ""; // Group UUID.
   
   key  owner; // Key of the owner.
 
////////////////////////////////////////////////////////////////////
 
default
{
    state_entry() // Script has started.
    {
        // Set the 'owner' value to the owner of the object.
        owner = llGetOwner();
        
        // Say the rezzed message (rez_msg).
        llOwnerSay(rez_msg);
        
        // Listen for messages
        llListen(-2487,"",owner,"");
    }
 
////////////////////////////////////////////////////////////////////
 
    on_rez(integer r) // Object has been rezzed.
    {
        // Reset the script.
        llResetScript();
    }
    
////////////////////////////////////////////////////////////////////
 
    touch_start(integer t) // Object was touched.
    {
        if(llDetectedKey(0) == llGetOwner()) // If the owner is the toucher.
        {
            // Open the menu.
            llDialog(owner,"\n"+mnu_msg,["Unpack"],-2487);
        }
    }
    
////////////////////////////////////////////////////////////////////
 
    listen(integer channel, string name, key id, string message) // Get messages from the menu.
    {
        
        if(message == "Unpack") // If the message is 'unpack'.
        {
            // Say the begin unpack message (unp_msg).
            llOwnerSay(unp_msg);
            
            // Remember the script name.
            string  thisScript      = llGetScriptName();
            
            // Remember the items in the inventory.
            list    inventoryItems;
            
            // The inventory item number.
            integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
            
            // The current inventory item number.
            integer index;
            
            for ( ; index < inventoryNumber; ++index ) // Process all inventory items.
            {
                //Set 'itemName' to the inventory name.
                string itemName = llGetInventoryName(INVENTORY_ALL, index);
 
                if (itemName != thisScript) // If the item name is not the name of this script.
                {
                    if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY) // If the item is copyable.
                    {
                        //Continue processing.
                        inventoryItems += itemName;
                    }
                }
            }
            
            // Give the inventory to the owner in a folder called the object's name.
            llGiveInventoryList(owner, llGetObjectName(), inventoryItems);
            
            // Say the finished unpack message (upd_msg).
            llOwnerSay(upd_msg);
        }
        
 
 
        if(message == "Landmark") // If the message is 'Landmark'.
        {
            if(llGetInventoryName(INVENTORY_LANDMARK, 0)) // If a landmark exists.
            {
                
                // Give the inventory to the owner.
                llGiveInventory(owner, llGetInventoryName(INVENTORY_LANDMARK, 0));
            }
            
            else // If there is no landmark.
            {
                // Tell the owner there is no landmark.
                llOwnerSay("Sorry! I couldn't find the landmark to give you.");
            }
        }
        
 
        
        if(message == "Group") // If the message is 'Group'.
        {
            // Say the group message (grp_msg), followed by the group link.
            llOwnerSay(grp_msg+" secondlife:///app/group/"+(string)grp_key+"/about");
        }
    }
}
////////////////////////////////////////////////////////////////////

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎