Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Unpackers?

Katie Mercy
Registered User
Join date: 21 Jun 2006
Posts: 3
06-23-2006 15:57
Hey ya'll. I am pretty new to SL and was wondering what the Unpacker is and how to use it? I would really appreciate some help. Thank you!

<3 Katie Mercy
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-23-2006 16:00
I don't really know what you mean by "unpacker", these things have different names (though I imagine it's llGiveInventoryList). Can you describe what it does, and then people can tell you how to do that?
Katie Mercy
Registered User
Join date: 21 Jun 2006
Posts: 3
06-23-2006 16:04
Okay when in the Animations folder in my inventory I see these things that are called "unpacker" and when I open that it says

list gInventoryList;

list getInventoryList()
{
integer i;
integer n = llGetInventoryNumber(INVENTORY_ALL);
list result = [];

for( i = 0; i < n; i++ )
{
result += [ llGetInventoryName(INVENTORY_ALL, i) ];
}
return result;
}

default
{
state_entry()
{
gInventoryList = getInventoryList();
}

touch_start( integer n )
{

integer i;

for( i = 0; i < n; i++ )
{
llGiveInventoryList(llDetectedKey(i), llGetObjectName(), gInventoryList );

}
}

changed( integer change )
{
if ( change == CHANGED_INVENTORY )
gInventoryList = getInventoryList();
}
}


It is under many things such as Animations and Textures. I have no idea how to script so if you could help me I would be eternally greatful
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
06-23-2006 17:10
Only problem with the one Katie posted is that anyone can touch to trigger the script, though if everything inside the box is Notrans it's not a problem, just give an error. Here's the script I use to allow people to unpack boxes for items I sell:
CODE
default
{
touch_start(integer total_number)
{
integer x;
for(x = 0; x < total_number; x++)
{
if(llDetectedKey(x) == llGetOwner())
{
string InvenName;
integer InvenNumber = llGetInventoryNumber(INVENTORY_ALL);
list InvenList = [];
integer y;
for(y = 0; y < InvenNumber; y++)
{
InvenName = llGetInventoryName(INVENTORY_ALL, y);
if(InvenName != llGetScriptName()) InvenList += [InvenName];
}
llGiveInventoryList(llGetOwner(), llGetObjectName(), InvenList);
}
}
}
}
This will give all contents of the box (except the unpacker script itself) to a new folder in the owner's contents when they touch. Only problem is it won't work for nocopy items.
_____________________
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
06-24-2006 00:54
This version is smaller and quicker:
CODE

{
touch_start(integer total_number)
{
integer InvenNumber = llGetInventoryNumber (INVENTORY_ALL);
string Script = llGetScriptName ();
integer i;
list InvenList;
for(i = 0; i < InvenNumber; i++)
{
string InvenName = llGetInventoryName (INVENTORY_ALL, i);
if (InvenName != Script) InvenList += InvenName;
}
key Owner = llGetOwner ();
string Folder_Name = llGetObjectName ();
for(i = 0; i < total_number; i++)
{
if(Owner == llDetectedKey (i))
{
llGiveInventoryList (Owner, Folder_Name, InvenList);
return;
}
}
}
}
Harmony Deschanel
Registered User
Join date: 4 Jan 2007
Posts: 32
11-17-2007 08:32
From: Kayla Stonecutter
Only problem is it won't work for nocopy items.


Is there a way to get a script to give out a nocopy item?