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

LSL Wiki : Inventory

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ec2-204-236-235-245.compute-1.amazonaws.com

Inventory


SL has two kinds of inventories: one for the user and one for objects (labeled "Content" in the client's object editor window). An inventory stores items: objects, scripts, textures, sounds, animations, body parts, clothing, gestures, landmarks, notecards, snapshots (which are just a special kind of texture taken with SL's "snapshot" feature), and calling cards.

Object inventory used to be limited to 255 items maximum, but there is currently no limit. While it's unlikely, there may be a limit imposed in the future. Object inventory cannot contain folders (other than the "Contents" folder) or items with the same name (unlike the user inventory). When a folder from a user's inventory is dropped into the inventory of an object, the folder's items are transferred individually to the object. Scripts transferred using this process are, unfortunately, deactivated (each script must be dragged seperately, or selected using shift and/or control-clicking and dragged as a mass selection), and a number is automatically appended to items without unique names.

There is currently no way to manipulate a user's inventory using a script.

The following functions can be used to manipulate an object's inventory:

Functions

llAllowInventoryDrop
llGetInventoryCreator
llGetInventoryKey
llGetInventoryName
llGetInventoryNumber
llGetInventoryType
: check item existence
llGetInventoryPermMask
llGetNotecardLine
llGetNumberOfNotecardLines
llGetScriptName
llGetScriptState
llGetStartParameter
llGiveInventory
llGiveInventoryList
llRemoteLoadScriptPin
llRemoveInventory
llResetOtherScript
llRequestInventoryData
llRezAtRoot
llRezObject
llSetRemoteScriptAccessPin
llSetScriptState


Constants

(used by llGetInventoryName and llGetInventoryNumber)

Constant Value Description Hex
INVENTORY_ALL -1 Look at all inventory items
INVENTORY_NONE -1 Returned by llGetInventoryType
INVENTORY_TEXTURE 0 Only look at textures 0x00
INVENTORY_SOUND 1 Only look at sounds 0x01
INVENTORY_LANDMARK 3 Only look at landmarks 0x03
INVENTORY_CLOTHING 5 Only look at clothing 0x05
INVENTORY_OBJECT 6 Only look at objects 0x06
INVENTORY_NOTECARD 7 Only look at notecards 0x07
INVENTORY_SCRIPT 10 Only look at scripts 0x0A
INVENTORY_BODYPART 13 Only look at body parts 0x0D
INVENTORY_ANIMATION 20 Only look at animations 0x14
INVENTORY_GESTURE 21 Only look at gestures 0x15

Note: inventory constants are not bitflags and thus should not be used with bitwise operators.

Events

changed
object_rez


Q: How do I give a user an item from my object's inventory?
A: Use llGiveInventory or llGiveInventoryList.

Q: How do I give a user a folder?
A: See llGiveInventoryList.

Q: How do I rename/copy/duplicate an item in my object's inventory?
A: You can't, though a script can delete items (even itself) with llRemoveInventory.

Q: How do I update a script in another object from an identically named script in my object's inventory?
A: See llRemoteLoadScriptPin but it requires the setup of a pin number.

Q: Is there a way to directly check if an item exists in inventory without having to run a for loop?
A: Yes, llGetInventoryType, though this function, like all inventory functions, is case sensitive.

Q: How do I make my script take an object from the world to my object's inventory?
A: A script can't take an object into its inventory. Neither can it take a copy of the object. An object can't put itself in another inventory either, and there's no way to send an in-world object to a user's inventory.

Q: Can item ordering (for the functions that get them) be assumed to be stable?
A: Object inventory is always sorted alphabetically. The order is stable and predictable.

Q: Can I find out what another prim has in its inventory?
A: No, not in another object, nor in an object your prim is linked to. In both cases, you would have to already have a script in each prim you wanted to check.

Q: Can I attach to an avatar an avatar inventory item instead of giving it (if I get permission of course...)?
A: No, you can only attach items rezzed in-world.


Functions | Events | Constants | Item
There are 5 comments on this page. [Display comments/form]