Skip to content

Instantly share code, notes, and snippets.

@madame-rachelle
Created July 9, 2020 19:51
Show Gist options
  • Select an option

  • Save madame-rachelle/e6c58358600b993a2f39e36832a9a8cc to your computer and use it in GitHub Desktop.

Select an option

Save madame-rachelle/e6c58358600b993a2f39e36832a9a8cc to your computer and use it in GitHub Desktop.
Wear me to unpack.lsl
// when the prim is touched, the script checks all other inventory items whether or not they're copiable
// copiable items are added to a list, if the list is not empty when all items have been checked
// the prim gives them to the touching avatar within a single folder
unpack(key target)
{
string thisScript = llGetScriptName();
list inventoryItems;
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
for ( ; index < inventoryNumber; ++index )
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (itemName != thisScript)
{
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
inventoryItems += itemName;
}
else
{
llOwnerSay("Unable to copy the item named '" + itemName + "'.");
}
}
}
if (inventoryItems == [] )
{
llOwnerSay("No copiable items found, sorry.");
}
else
{
llGiveInventoryList(target, llGetObjectName(), inventoryItems); // 3.0 seconds delay
}
}
default
{
touch_start(integer num_detected)
{
unpack(llGetOwner());
}
on_rez(integer start_param)
{
unpack(llGetOwner());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment