You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
llAllowInventoryDrop(integer allow)
Enables or disables the possibility for the prim to accept inventory from anyone.
llAllowInventoryDrop(TRUE); // Allows anyone to drop items. llAllowInventoryDrop(FALSE); // Stops allowing anyone to drop items.
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 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.
llRemoveInventory
to remove an item from the prim's contents.