Unofficial LSL Reference

[[functions:llallowinventorydrop]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Function: llAllowInventoryDrop

llAllowInventoryDrop(integer allow)

Enables or disables the possibility for the prim to accept inventory from anyone.

Parameters

allow

Boolean value indicating whether to allow inventory drop (when TRUE) or not (when FALSE).

Notes

  • The dropped items change ownership at the moment they are dropped. No-transfer items can't be dropped.
  • Scripts can't be dropped either. The dropper will receive a notification message: "Not permitted to edit this".
  • When an item is dropped with this option enabled, and the person who drops the item into the prim doesn't have modify rights on that prim, a changed event will be generated with the CHANGED_ALLOWED_DROP flag set. However, if the person dropping the item has edit rights, then the setting of this function has no effect, and the flag for the changed event will be CHANGED_INVENTORY instead.
  • The Locked checkbox has no effect on the ability to drop: a locked object can still receive items. The official documentation says the opposite, but experimentation shows this to be the case (with Server 14.10.17.295641).
  • All items except textures, objects and scripts (that is, notecards, landmarks, clothing pieces, body parts, etc.) can be dropped by just dragging them from inventory. Objects and textures can be dropped by holding Ctrl before releasing the mouse button. Alternatively, editing the prim and dropping the item into the Contents tab works as well.
  • There is no way to determine who dropped an item, or what item it was. You can however enable drop when someone clicks, and assume that the first item dropped since then is from the person who clicked. See Complete examples below.
  • This setting is NOT a prim property, it is per script. Deleting or stopping all scripts that changed it from default will cause the effect to cease, and the behaviour to revert to default.

Short examples

llAllowInventoryDrop(TRUE); // Allows anyone to drop items.
llAllowInventoryDrop(FALSE); // Stops allowing anyone to drop items.

Complete examples

This implements a very simple drop box, allowing someone to touch the prim to drop an item, and notifying the owner about who did it.

llAllowInventoryDrop-example.lsl
string WhoDropped;
integer in_use;

RevertToDefault()
{
    llSetText("Touch to drop an item", <1, 1, 1>, 1);
    llSetTimerEvent(0);
    in_use = FALSE;
    llAllowInventoryDrop(FALSE);
}

default
{
    state_entry()
    {
        RevertToDefault();
    }

    touch_start(integer n)
    {
        if (in_use)
        {
            llRegionSayTo(llDetectedKey(0), 0, "Sorry, this drop box is in use. Please wait until it's free.");
            return;
        }
        in_use = TRUE;
        llAllowInventoryDrop(TRUE);
        WhoDropped = llDetectedName(0);
        llSetText(WhoDropped + ", please drop your item in the next 30 seconds.", <1, 1, 1>, 1);
        llSetTimerEvent(30);
    }

    changed(integer change)
    {
        if (change & CHANGED_ALLOWED_DROP)
        {
            RevertToDefault();
            llInstantMessage(llGetOwner(), WhoDropped + " dropped an item!");
        }
    }

    timer()
    {
        RevertToDefault();
    }
}

The example is kept as simple as possible, and for that reason it doesn't recognize what was the last item dropped.

The latter can be roughly done with a list that tracks the last known inventory of the prim, and comparing it with the list at the time a CHANGED_ALLOWED_DROP or a CHANGED_INVENTORY event is received.

As an easier alternative, it's possible to give the items to another prim in the linkset (using llGiveInventory and llGetLinkKey) as they are received, deleting them from the current prim if they are copyable (using llGetInventoryPermMask to check the latter). That will help determine what the dropped items are.

See also

  • changed event is triggered when a successful drop occurs.
  • llRemoveInventory to remove an item from the prim's contents.