Gives inventory items to agent, creating a new folder to put them in.

Syntax

integer llGiveAgentInventory( key agent, string folder, list inventory, list options );

Forced delay: 3.0 seconds. Energy: 10.0.

Parameters

key agent
agent to receive inventory offer.
string folder
destination folder name to use.
list inventory
list of inventory items to give to the agent
list options
list of options for inventory transfer.

Return value

Returns an integer

Specification

Constants

Transfer Options

FlagsParametersDescription
TRANSFER_DEST0[ TRANSFER_DEST, string ]Sets a root path that will be used as the parent for folder. If the root path does not exist it will be created.

If it already exists in the target inventory it will be reused. Path folders are separated by a "|" character. The path may have have up to 4 folders in it.

Note that transfers to certain system folders (such as 'Trash') are disallowed.

Examples:
"Objects|Vehicles|My Motorcycle Company"
"Clothing|Shoes|Breedables"
"My Store|Home & Garden|"

TRANSFER_FLAGS1[ TRANSFER_FLAGS, integer ]There are no flags defined at this time.

Transfer Errors

ConstantDescription
TRANSFER_OK0No error detected, inventory transferred
TRANSFER_BAD_OPTS-1A bad option was passed in the options list.
TRANSFER_NO_TARGET-2Could not find the receiving agent in the current region.
TRANSFER_THROTTLE-3Transfer rate exceeded the inventory transfer throttle.
TRANSFER_NO_ITEMS-4The list of items was empty or contained only non-transferable items.
TRANSFER_BAD_ROOT-5The root path specified in TRANSFER_DEST contained an invalid directory or was reduced to nothing.
TRANSFER_NO_PERMS-6The object does not have transfer permissions.
TRANSFER_NO_ATTACHMENT-7Can not transfer ownership of an attached object.

Caveats

Examples

In this example, the object inventory needs to contain two objects named Item 1 and Item 2. The destination folder will be named Destination Folder and will be created under the main folder Objects, in the sub-folder Subfolder. If Subfolder does not exist, it will be created.

If the object gets touched for a second time, the sub-folder Subfolder will not be duplicated, however the destination folder Destination Folder will be duplicated.

If Item 1 and/or Item 2 do not exist, the transfer will silently fail partially or completely.

default
{
    touch_start(integer total_number)
    {
        llGiveAgentInventory(llDetectedKey(0), "Destination Folder", ["Item 1","Item 2"], [TRANSFER_DEST, "Objects|Subfolder"] );
    }
}

See also

Events

Functions