Don't click here unless you want to be banned.

LSL Wiki : llGiveInventoryList

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llGiveInventoryList(key destination, string category, list inventory)

Give the list of named inventory items to the keyed agent (anywhere in the world--see notes below) or object (in the same simulator as the giver) destination. If the recipient is an agent, the user follows the normal procedure of accepting or denying the offer. The offered inventory is then placed in a folder named category in the recipient's inventory. If the recipient is an object, the same permissions apply as if the user dragged inventory onto the object by hand, i.e., if llAllowInventoryDrop has been called with TRUE, any other object can pass items to its inventory. If the recipient is an object, the category parameter is ignored--an object cannot contain folders in its inventory.

Notes:

Example:
default
{
    on_rez(integer nevermind)
    {
        llSetText("Touch me to unpack\nyour new "+llGetObjectName()+".",<1,1,1>,1.0);
    }
    touch_start(integer total_number)
    {
// give all items in a prim to the owner, as folder (with the name of the prim)
// Ezhar Fairlight <efairlight@gmail.com>

// user-friendly additions by Mechanique Thirty (egypt@urnash.com)
// Script adjusted to run faster by Strife Onizuka.

        list        inventory;
        string      name;
        integer     num = llGetInventoryNumber(INVENTORY_ALL);
        string      text = llGetObjectName() + " is unpacking...\n";
        integer     i;
        key         user = llGetOwner();//Set to llDetectedKey(0); to allow anyone to use
        
        for (i = 0; i < num; ++i) {
            name = llGetInventoryName(INVENTORY_ALL, i);
            if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
                inventory += name;
            else
                llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission");
            llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
        }
        
        //chew off the end off the text message.
        text = llGetObjectName();
        
        //we don't want to give them this script
        i = llListFindList(inventory, [llGetScriptName()]);
        if(~i)//if this script isn't found then we shouldn't try and remove it
            inventory = llDeleteSubList(inventory, i, i);
        
        if (llGetListLength(inventory) < 1) llSay(0, "No items to offer."); else
        {
            llGiveInventoryList(user, text, inventory);
            llSetText("All done!\nYou can delete this now!",<1,1,1>,1);
            name = "Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'. Drag it onto your avatar to wear it!";
            if(user == llGetOwner())
                llOwnerSay(name);
            else
                llInstantMessage(user, name);
        }
    }
}

Q: Is there a way to give items into an existing folder or subfolder in a user's inventory?
A: No. The recipient will recieve the items in a new folder with the name specified in category within their inventory's root. There's no way to create a folder within their 'Clothing' folder, for example.

Q: So can I use llGiveInventoryList to give items that I can copy, but that have been set to prohibit other users from copying?
A: Yes. llGiveInventoryList will only prevent a script from giving an items if its owner does not have permissions copy permission. See llGetInventoryPermMask for more details on the difference between a "no-copy" item the creator can copy, and a no-copy item after it's been transferred to another user.

Q: What if the user I'm trying to give the objects to is offline?
A: If their offline buffer isn't full, and they don't have the object giving the items muted, they will be able to accept the transfer when they log on.

I seriously doubt if this is true. It gives me a "Cannot find destination" error -- FuRaz
This error seems to appear if the destination avatar was never on the sim where the object invoking llGiveInventoryList() is used, like described above. This is quite frustrating! -- GwynethLlewelyn

If the category argument of llGiveInventoryList is set to an empty string, it appears that the object(s) in the list are given individually into destination's inventory root. (02/04/09). -- GanymedeCeriaptrix


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Inventory | llGiveInventory
There are 9 comments on this page. [Display comments/form]