Advertisement
LethBaumann

Give Selected Contents In Folder Instead of ALL

Apr 28th, 2021
1,626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer type = INVENTORY_ALL;
  2. /// Types:   INVENTORY_ALL, INVENTORY_NONE , INVENTORY_TEXTURE, INVENTORY_SOUND
  3. //           INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD
  4. //           INVENTORY_SCRIPT, INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE
  5. default {
  6.     state_entry() {
  7.         llSetText(llGetObjectName(), <1,1,1>,1);
  8.         llOwnerSay("Touch to unpack");
  9.     }
  10.     on_rez(integer rez) {
  11.         llResetScript();
  12.     }
  13.     touch_end(integer total_number) {
  14.         if (llDetectedKey(0) != llGetOwner()) return;
  15.         list        inventory;
  16.         string      name;
  17.         integer     num = llGetInventoryNumber(type);
  18.         string      text = llGetObjectName() + " is unpacking...\n";
  19.         integer     i;
  20.         list no_copy;
  21.         for (i = 0; i < num; ++i) {
  22.             name = llGetInventoryName(type, i);
  23.             if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY) {
  24.                 inventory += name;
  25.                 llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
  26.             } else {
  27.                 no_copy = no_copy + name;
  28.                 llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission, this item will be given seperatly");
  29.                 llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
  30.             }
  31.         }
  32.         integer x;
  33.         integer oops = llGetListLength(no_copy);
  34.         if (oops >= 1) {
  35.             llOwnerSay("Preparing to give " + (string)oops + " objects that were not copy permission, one by one.");
  36.             for (x = 0; x < oops; ++x) {
  37.                 llGiveInventory(llGetOwner(), llGetInventoryName(type, x));
  38.             }
  39.         }            
  40.         text = llGetObjectName();
  41.         llGiveInventoryList(llGetOwner(), text, inventory);
  42.         llSetText(llGetObjectName(), <1,1,1>,1);
  43.         llInstantMessage(llGetOwner(), "Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'");
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement