Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer type = INVENTORY_ALL;
- /// Types: INVENTORY_ALL, INVENTORY_NONE , INVENTORY_TEXTURE, INVENTORY_SOUND
- // INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD
- // INVENTORY_SCRIPT, INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE
- default {
- state_entry() {
- llSetText(llGetObjectName(), <1,1,1>,1);
- llOwnerSay("Touch to unpack");
- }
- on_rez(integer rez) {
- llResetScript();
- }
- touch_end(integer total_number) {
- if (llDetectedKey(0) != llGetOwner()) return;
- list inventory;
- string name;
- integer num = llGetInventoryNumber(type);
- string text = llGetObjectName() + " is unpacking...\n";
- integer i;
- list no_copy;
- for (i = 0; i < num; ++i) {
- name = llGetInventoryName(type, i);
- if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY) {
- inventory += name;
- llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
- } else {
- no_copy = no_copy + name;
- llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission, this item will be given seperatly");
- llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
- }
- }
- integer x;
- integer oops = llGetListLength(no_copy);
- if (oops >= 1) {
- llOwnerSay("Preparing to give " + (string)oops + " objects that were not copy permission, one by one.");
- for (x = 0; x < oops; ++x) {
- llGiveInventory(llGetOwner(), llGetInventoryName(type, x));
- }
- }
- text = llGetObjectName();
- llGiveInventoryList(llGetOwner(), text, inventory);
- llSetText(llGetObjectName(), <1,1,1>,1);
- llInstantMessage(llGetOwner(), "Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement