Difference between revisions of "LlGetInventoryName"

From Second Life Wiki
Jump to: navigation, search
m (sp)
Line 74: Line 74:
 
|also_functions=
 
|also_functions=
 
{{LSL DefineRow||[[llGetInventoryNumber]]|Returns the number of items of a specific type in inventory}}
 
{{LSL DefineRow||[[llGetInventoryNumber]]|Returns the number of items of a specific type in inventory}}
{{LSL DefineRow||[[llGetInventoryType]]|Tests to see if an inventory item exists and returns it's type.}}
+
{{LSL DefineRow||[[llGetInventoryType]]|Tests to see if an inventory item exists and returns its type.}}
 
{{LSL DefineRow||[[llGetInventoryCreator]]|Returns the inventory item's creator}}
 
{{LSL DefineRow||[[llGetInventoryCreator]]|Returns the inventory item's creator}}
 
{{LSL DefineRow||[[llGetInventoryPermMask]]|Returns the inventory item's permissions}}
 
{{LSL DefineRow||[[llGetInventoryPermMask]]|Returns the inventory item's permissions}}

Revision as of 23:15, 8 November 2007

Summary

Function: string llGetInventoryName( integer type, integer number );

Returns a string that is the name of the inventory item number of type. Returns an empty string if no item of the specified type is found in the prim's inventory.

• integer type INVENTORY_* flag
• integer number

number does not support negative indexes.

Flag Inventory Type
INVENTORY_NONE -1 Item does not exist.
INVENTORY_ALL Any inventory type.
INVENTORY_TEXTURE 0 texture
INVENTORY_SOUND 1 sound
INVENTORY_LANDMARK 3 landmark
INVENTORY_CLOTHING 5 clothing
Flag Inventory Type
INVENTORY_OBJECT 6 object
INVENTORY_NOTECARD 7 notecard
INVENTORY_SCRIPT 10 script
INVENTORY_BODYPART 13 body part
INVENTORY_ANIMATION 20 animation
INVENTORY_GESTURE 21 gesture
INVENTORY_SETTING 56 setting

Caveats

  • If number is out of bounds the script continues to execute without an error message.
All Issues ~ Search JIRA for related Bugs

Examples

Will Unpack all items of a box
// script created by SpiritWolf Chikuwa
// minor changes by Strife Onizuka to speed things up
//
// /!\ PUBLIC DOMAIN /!\
// You can Copy/Mod/Trans 
// Please, do not resell this script and give it full perm
// Just please leave this header intact
//
// Minor changes: (insert your name here and delete this comment if you do any mod of this script, thank you)
//
// Script start here:

list    gInventoryList;

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

    while(i < n)
    {
        result += llGetInventoryName(INVENTORY_ALL, i);
        ++i;
    }
    return result;
}

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

    touch_start( integer n )
    {
        integer i = 0;
        string folder = llGetObjectName();

        while(i < n)
        {
            llGiveInventoryList(llDetectedKey(i), folder, gInventoryList );
            ++i;
        }
    }

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

// llGetInventory number and name will scan all objects on the box.
// llGiveInventory will give you the content.
// See also llGetInventory and llGiveInventory on LSL Wiki for further informations.

See Also

Functions

•  llGetInventoryNumber Returns the number of items of a specific type in inventory
•  llGetInventoryType Tests to see if an inventory item exists and returns its type.
•  llGetInventoryCreator Returns the inventory item's creator
•  llGetInventoryPermMask Returns the inventory item's permissions
•  llGetInventoryKey Returns the inventory item's UUID (if full perm)

Deep Notes

Search JIRA for related Issues

Signature

function string llGetInventoryName( integer type, integer number );