Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Is there a way to count and List the contents of a box?

VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
09-08-2008 15:02
Looking to do some inventory Control.. and it would be awesome to have a script that counts and lists all contents of a prim

Also while at it... is there a way to transfer contents from one prim to another without taking it into inventory?

thanks \m/
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
09-08-2008 15:07
One can use loops with the assorted Inventory functions to obtain this. For instance, the following function will return the names of all inventory items in that prim:
CODE


list get_all_inventory_names()
{
list names = [];
integer f = llGetInventoryNumber(INVENTORY_ALL) - 1;
do {
names = (names = []) + [llGetInventoryName(INVENTORY_ALL, f)] + names;
} while (--f >= 0);
return names;
}


As for the latter point, prims can give inventory to other prims; it is how self-replicating objects work.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names