Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

delete prims after unpacking

Tarina Sewell
Just Browsing Thank you
Join date: 20 Jul 2007
Posts: 2,180
06-20-2009 19:04
Is there an available script (I am not a scripter but can edit) that will delete a prim that has has items in it after copy to inventory?

For my stores packaged items.


Thanks. ; )
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
06-20-2009 23:31
From the wiki :

http://wiki.secondlife.com/wiki/LlGiveInventoryList

From: someone


default
{
touch_start(integer total_number)
{
list inventory;
integer num = llGetInventoryNumber(INVENTORY_ALL);
string script = llGetScriptName();
integer i = 0;

for (; i < num; ++i) {
string name = llGetInventoryName(INVENTORY_ALL, i);
//Don't give them the selling script.
if(name != script)
{
if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
{
inventory += name;
}
else
{
llSay(0, "Don't have permissions to give you \""+name+"\".";);
}
}
}

if (llGetListLength(inventory) < 1)
{
llSay(0, "No items to offer.";);
}
else
{
// give folder to agent, use name of object as name of folder we are giving
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventory);

state RIP;
}
}
state RIP
{
//the magic begins :P
state_entry()
{
integer olf;
for(olf = 5; olf > 0; --olf)
llSay(0,"Deleting my self in: "+ (string)olf);
llDie();


}


}
}

_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Dawn Kayor
Registered User
Join date: 18 Apr 2009
Posts: 7
06-21-2009 07:50
the above script won't work. the state rip is in the wrong place. here's the fixed one for the new coders that would stumble through it. not tested just assume it works.

CODE

default
{
touch_start(integer total_number)
{
list inventory;
integer num = llGetInventoryNumber(INVENTORY_ALL);
string script = llGetScriptName();
integer i = 0;

for (; i < num; ++i)
{
string name = llGetInventoryName(INVENTORY_ALL, i);
//Don't give them the selling script.
if(name != script)
{
if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY)
{
inventory += name;
}
else
{
llSay(0, "Don't have permissions to give you \""+name+"\".");
}
}
}

if (llGetListLength(inventory) < 1)
{
llSay(0, "No items to offer.");
}
else
{
// give folder to agent, use name of object as name of folder we are giving
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventory);

state RIP;
}
}

}
state RIP
{
//the magic begins :P
state_entry()
{
integer olf;
for(olf = 5; olf > 0; --olf)
llSay(0,"Deleting my self in: "+ (string)olf);
llDie();


}


}
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
06-21-2009 13:19
From: Dawn Kayor
the above script won't work. the state rip is in the wrong place. here's the fixed one for the new coders that would stumble through it. not tested just assume it works.

Sorry i post it 5:30 in the morning with out test it in SL....
_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-21-2009 19:12
neither version will delete when open --> copy all is used

for that you'll need to check against the changed event, and see if there are any no-copy items left, and for safety you should ask the user before deleting, since it's possible they'll copy one item at a time, or may want to keep the original box with the copyable items in it.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -