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:
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