Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Only-Owner inventory giver

Erik Bligh
Registered User
Join date: 25 Feb 2006
Posts: 27
05-26-2007 07:45
I was wondering if anyone had a script that only gives an object's inventory to the owner upon touch.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-26-2007 08:03
There are a couple ways to do that.

Would it be all items in inventory, including the scripts, or just the objects?
Looping through inventory before the give happens can focus on just specific types, or give everything.

There is also a function (llGiveInventoryList) which allows the items to go to a specific folder in the owners inventory.

Do you have any more specifics on what you're trying to do?
Erik Bligh
Registered User
Join date: 25 Feb 2006
Posts: 27
05-26-2007 08:06
It's for a texture set. I want it to be able to simply copy to the inventory rather than all the textures opening when you try to transfer to your inventory. It needs to be owner only so people can't steal my textures when the box is on display
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-26-2007 08:22
Something like this should do it (though it would take more tinkering to handle inventory drops or other stuff):

CODE

string gFolder = "GotTextures";

key gowner;
key gtoucher;
integer gx;
integer gcount;
list gtextures;

default
{
on_rez(integer param)
{
llResetScript();
}

state_entry()
{
gowner = llGetOwner();
gcount = llGetInventoryNumber(INVENTORY_TEXTURE);
for (gx = 0; gx < gcount; gx++)
{
gtextures = (gtextures = []) + gtextures + [llGetInventoryName(INVENTORY_TEXTURE, gx)];
}
}

touch_start(integer total_number)
{
gtoucher = llDetectedKey(0);
if (gtoucher == gowner)
{
llGiveInventoryList(gowner, gFolder, gtextures);
}
}
}