Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

||Give Contents Error

Arbel Vogel
Burstin' w/Fruit Flavor
Join date: 17 Oct 2004
Posts: 1,155
02-15-2006 19:18
Hi, I have added objects to my vendor with this unpacking script:

CODE


Example:
default
{
on_rez(integer nevermind)
{
llSetText("Touch me to unpack\nyour new "+llGetObjectName()+".",<1,1,1>,1.0);
}
touch_start(integer total_number)
{
// give all items in a prim to the owner, as folder (with the name of the prim)
// Ezhar Fairlight <efairlight@gmail.com>

// user-friendly additions by Mechanique Thirty (egypt@urnash.com)
// Script adjusted to run faster by Strife Onizuka.

if(llDetectedKey(0) != llGetOwner()) return;
list inventory;
string name;
integer num = llGetInventoryNumber(INVENTORY_ALL);
string text = llGetObjectName() + " is unpacking...\n";
integer i;

for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
inventory += name;
else
llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission");
llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
}

//chew off the end off the text message.
text = llGetObjectName();

//we don't want to give them this script
i = llListFindList(inventory, [llGetScriptName()]);
inventory = llDeleteSubList(inventory, i, i);

if (llGetListLength(inventory) < 1) llOwnerSay("No items to offer."); else
{
llGiveInventoryList(llGetOwner(), text, inventory);
llSetText("All done!\nYou can delete this now!",<1,1,1>,1);
llOwnerSay("Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'. Drag it onto your avatar to wear it!");
}
}
}


When I unpack it, everything works fine, I get all the items, and no errors. But when other people unpack the object, there are some reports of permission errors (all of my clothes are mod/copy), and all the reports also consist of the customer not getting all the items unpacked in a folder, so they have to get it out manually. I don't know if it's the script, or the permissions (the object with where the items are placed is mod/copy as well). So please help, for now I just have a warning sign about it in my store. Thanks in advance :)
_____________________


Winter Moon, located at Koreshan/70/71/24

Visit my blog for updates!
http://wintermoonclothing.blogspot.com/
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-15-2006 19:41
Asset permissions (not be confused with script permissions), are accumulated.

For example:
Create an object, set it's permissions to full (everything checked)
now drop anything into it and set it's permissions to: no-copy no-mod.

When you give this object to someone else, while that secondary item is inside the object, it will be no-copy no-mod. Scripts will see this the same way. Permissions are inherited from child assets.

The llGiveInventory* functions have been restricted so they can not give no-copy items, that is, they cannot give out an item to anyone which the owner does not have the copy permissions on.

Now I think about it this script should be modified...
now it should display what ever errors to you as it would your clients (who will still see the same errors).
CODE

Example:
default
{
on_rez(integer nevermind)
{
llSetText("Touch me to unpack\nyour new "+llGetObjectName()+".",<1,1,1>,1.0);
}
touch_start(integer total_number)
{
// give all items in a prim to the owner, as folder (with the name of the prim)
// Ezhar Fairlight <efairlight@gmail.com>

// user-friendly additions by Mechanique Thirty (egypt@urnash.com)
// Script adjusted to run faster by Strife Onizuka.

if(llDetectedKey(0) != llGetOwner()) return;
list inventory;
string name;
integer num = llGetInventoryNumber(INVENTORY_ALL);
string text = llGetObjectName() + " is unpacking...\n";
integer i;

for (i = 0; i < num; ++i) {
name = llGetInventoryName(INVENTORY_ALL, i);
if(llGetInventoryPermMask(name, MASK_NEXT) & PERM_COPY)
inventory += name;
else
llOwnerSay("Cannot give asset \""+name+"\", owner lacks copy permission");
llSetText(text + (string)((integer)(((i + 1.0) / num) * 100))+ "%", <1, 1, 1>, 1.0);
}

//chew off the end off the text message.
text = llGetObjectName();

//we don't want to give them this script
i = llListFindList(inventory, [llGetScriptName()]);
inventory = llDeleteSubList(inventory, i, i);

if (llGetListLength(inventory) < 1) llOwnerSay("No items to offer."); else
{
llGiveInventoryList(llGetOwner(), text, inventory);
llSetText("All done!\nYou can delete this now!",<1,1,1>,1);
llOwnerSay("Your new "+ text +" can be found in your inventory, in a folder called '"+ text +"'. Drag it onto your avatar to wear it!");
}
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Arbel Vogel
Burstin' w/Fruit Flavor
Join date: 17 Oct 2004
Posts: 1,155
02-15-2006 23:14
Thank you! That helped muchly! :D
_____________________


Winter Moon, located at Koreshan/70/71/24

Visit my blog for updates!
http://wintermoonclothing.blogspot.com/
Hans Reitveld
Registered User
Join date: 21 Jun 2005
Posts: 16
02-16-2006 07:38
From: Strife Onizuka
The llGiveInventory* functions have been restricted so they can not give no-copy items, that is, they cannot give out an item to anyone which the owner does not have the copy permissions on.


Strife, the wiki for llGiveInventoryList is exactly as you describe it; in the Q&A for llGiveInventory, though, it says

"Q: When I try to give an inventory item to an agent, the item disappears from the original object's inventory. What's going on?
A: This is happening because you don't have copy permission on the item you're trying to give. Consequently, the script gives the only copy of the item in your object...."

I think a for loop issuing sequential llGiveInventory calls would work, though I imagine it would pop up the "accept" dialog every time.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-16-2006 09:36
The QA section is wrong. LL in 1.7? or was it 1.8 changed it so that both llGiveInventory & llGiveInventoryList cannot transfer no-copy items (no copy as in the current owner cannot copy). I beleive this restriction may have been carried over to llRezObject & llRezAtRoot.

Course they might have reveresed this, i've not actualy checked the validity.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Riann Maltese
!@%$#
Join date: 20 Jul 2005
Posts: 35
02-16-2006 10:38
You can llGiveInventory on no copy objects as of yesterday, and yes it pops up the accept dialog for every item.