llGiveInventory(key destination, string inventory)
Gives the named inventory item
to the agent
with the key destination
have to be in the same sim
can receive inventory regardless of where they are. If the user
isn't online, they will receive a dialog
box when they next log in, asking them whether they would like to accept or decline the object's inventory offer. If offline IMs
are enabled, they will also receive an email notification saying they have been offered inventory.
If the recipient is an agent, the user then follows the normal procedure of accepting or denying the offer. If the recipient is an object, the same permissions
apply as if a user dragged an inventory item onto the object manually, i.e. if llAllowInventoryDrop
has been called with TRUE
, any other object can pass items to its inventory. No-copy objects can not be given from attachments
If the recipient is an object, and the object already has something in its inventory with this name, then Second Life will check to see if the object being given differs from the object already existing in the recipient's inventory, or if it is another copy of the same object (ie, the object is being given multiple times). If it is the same object being given multiple times, nothing happens at all, and the recipient's inventory does not change. If the object is deemed to be a different object with the same name, it will create a new copy with an incremented number, as if a user manually placed an item with a duplicate name into an object's inventory. This differs from what happens if llRemoteLoadScriptPin
places a script with a duplicate name into an object's inventory.
If you give a script
the transfer will be done on the asset server but the script VM won't be loaded into the sim
containing the object. This will cause the script to be unable to be started by normal means. To start the script you must either recompile it (forcing the sim
to load the new VM) or pick the object up, rez it in world again, then the script may be set to running by normal means (check box in script window, set all scripts in selection to running via the tools menu, or by using llSetScriptState
from another script. If you need to give a running script to an object, use llRemoteLoadScriptPin
. A recipient that has recieved a non-running script from an llGiveInventory
call cannot start that script running within itself, but it can still give that script to a further object using llRemoteLoadScriptPin
, and the script will still be started on the recipient of the llRemoteLoadScriptPin
if the parameters to that call specified that it should be.
A script may give itself.
If you attempt to give a large number of objects within a short period of time (such as using multiple scripts to increase speed) or you rez a self-replicating object that attempts to give objects, you may run into the Grey Goo Fence
, which attempts to slow grid attacks.
Note: This function delays
for 3 seconds if the target is an avatar. Object to object transfers seem to have no delay, and the delay text has been removed from the SL tooltip.
Q: How do I just make a script that just gives someone the only object/notecard/texture in inventory?
A: Simple, do this:
Q: Is there a way to have an object give itself?
A: No, but it's possible to put a copy of the object into itself that it can then give, which is sufficient for many uses. Also, here's a feature suggestion thread asking for it. This sort of thing is sometimes used in self-replicating objects.
Q: Can an object refuse an item based on a conditional statement?
A: No, but if you keep track of the inventory your object contains, you can remove unwanted items using llRemoveInventory when the changed event is called with CHANGED_INVENTORY in its integer parameter.
Q: How can I confirm the intended recipient actually recieved the item?
A: You can't, not automatically. If giving an item to an object, the recipient object could contain a script with a changed event, allowing it to llSay a "received item" message. When giving an item to an agent, you're probably out of luck.
Q: Can I choose which folder the inventory item goes into?
A: Not with llGiveInventory. Instead, use llGiveInventoryList, with the list containing the single item (to an agent in the same sim).
Q: When I try to give an inventory item, the item disappears from the original object's inventory. What's going on?
A: This is happening because you don't have copy permission on the item you're trying to give. Consequently, the script gives the only copy of the item in your object. To determine whether or not you have permission to give the objects specified, use llGetInventoryPermMask.
Q: Can my object give inventory to an object owned by another user?
A: Yes, but only if the receiving object has llAllowInventoryDrop set to TRUE. See CHANGED_ALLOWED_DROP under the changed event.
Q: Can prims in a linked object be given inventory items?
A: Yes. You must use llGetLinkKey to do it though.
Also see llGiveInventoryList
to give several items at once, or to give items in a folder.
This article wasn't helpful for you? Maybe the related article at the LSL Portal
is able to bring enlightenment.