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

LSL Wiki : Inventory

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


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:


: check item existence


(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.



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
Comments [Hide comments/form]
Am I just stupid, or is there a bug when it comes to rezzing objects from attachments?
-- DolusNaumova (2005-08-16 15:32:57)
It seems to work fine for me. One common problem with llRezObject is correctly determining the 10m outer radius beyond which objects cannot be rezzed. See the llRezObject page for more.
-- CatherineOmega (2005-08-27 04:57:34)
Group owned objects cannot give inventory - doesn't seem to be listed anywhere I can see, and they can't use either function. Anyone know when this changed?
-- EloisePasteur (2005-09-11 10:43:40)
Is the inventory no-copy?
-- BlindWanderer (2005-09-11 17:12:29)
Can someone please remove the griefer-span (and the griefer, if possible)
-- (2007-12-21 09:26:43)
Attach a comment to this page: