$nav ===== Function: llAllowInventoryDrop ===== llAllowInventoryDrop(integer allow) Enables or disables the possibility for the prim to accept inventory from anyone. ===== Parameters ===== === allow === $lty[Boolean] value indicating whether to allow inventory drop (when $lct[TRUE]) or not (when $lct[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 $lev[changed] event will be generated with the $lct[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 $ev[changed] event will be $lct[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. * $perscript ===== 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. 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 $ct[CHANGED_ALLOWED_DROP] or a $ct[CHANGED_INVENTORY] event is received. As an easier alternative, it's possible to give the items to another prim in the linkset (using $lfn[llGiveInventory] and $lfn[llGetLinkKey]) as they are received, deleting them from the current prim if they are copyable (using $lfn[llGetInventoryPermMask] to check the latter). That will help determine what the dropped items are. ===== See also ===== * $lev[changed] event is triggered when a successful drop occurs. * $lfn[llRemoveInventory] to remove an item from the prim's contents.