Difference between revisions of "User:Toady Nakamura/Prim Contents Lister"
Jump to navigation
Jump to search
m |
m (<source lang="lsl2">) |
||
Line 7: | Line 7: | ||
<source lang="lsl2"> | |||
< | |||
// FLOAT BOX CONTENTS -- Rolig Loon -- November 2009 | // FLOAT BOX CONTENTS -- Rolig Loon -- November 2009 | ||
// //Modified Toady Nakamura 11/13/13 // Leave the header!! | // //Modified Toady Nakamura 11/13/13 // Leave the header!! | ||
Line 63: | Line 62: | ||
} | } | ||
</ | </source> | ||
Visit my LSL wiki page for my library of simple scripts ! [[User:Toady Nakamura|Toady Nakamura]] |
Revision as of 14:39, 11 January 2016
From an SL wiki [1] which lists it to hover text. But it's easier to use if it outputs to the local chat, so I modded it to do that and also to wait and not repeat every 5 seconds the way he had it!
If it doesn't show all the items the first time it tells you touch the box and it will keep telling!
// FLOAT BOX CONTENTS -- Rolig Loon -- November 2009
// //Modified Toady Nakamura 11/13/13 // Leave the header!!
// Free to copy, modify, or distribute.
// Please do not sell this script. Be nice.
list contents = [];
default
{
state_entry()
{
// this is a list of all the possible inventory types, as constants.
list list_types = [INVENTORY_NONE, INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_LANDMARK,
INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD, INVENTORY_SCRIPT,
INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE];
// this list is of the string names corresponding to the one above.
list list_names = ["None", "Texture", "Sound", "Landmark", "Clothing", "Object", "Notecard",
"Script", "Body Part", "Animation", "Gesture"];
integer all = llGetInventoryNumber(INVENTORY_ALL);
integer i;
for (i=0;i<=all-1;++i)
{
integer detected_type = llGetInventoryType(llGetInventoryName(INVENTORY_ALL,i)); // look up which type this object is.
integer type_index = llListFindList(list_types,[detected_type]); // where in list_types is this type?
string type_name = llList2String(list_names, type_index); // get the corresponding entry in the names list.
contents += type_name + ": " + llGetInventoryName(INVENTORY_ALL,i) + "\n "; //Display type of content item and its name
}
llSetTimerEvent(1);
llOwnerSay("This box lists contents when you reset the script, add or take something from contents, and / or touch the box.");
}
changed(integer change)
{
if (change & CHANGED_INVENTORY) // If something is added to or removed from box inventory
{
llResetScript();
}
}
touch_start(integer numb)
{
llSetTimerEvent(1.0);
}
timer()
{
contents = llList2List(contents,1,-1) + llList2String(contents,0); // Move item 0 to the end of the list
list temp = llList2List(contents,-8,-1); // Display only the last eight items
llOwnerSay("THIS BOX CONTAINS: \n " + llDumpList2String(temp,""));
llSetTimerEvent(0.0);
}
}
Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura