OsGetLinkInventoryNames

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{osslfunc |threat_level=ignored |permissions=true |delay=0|function_syntax=osGetLinkInventoryNames(integer linkNumber, integer type)<br> |ossl_example=<source lang="lsl"> </s...")
 
m (Note about order)
 
(3 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
|threat_level=ignored
 
|threat_level=ignored
 
|permissions=true
 
|permissions=true
|delay=0|function_syntax=osGetLinkInventoryNames(integer linkNumber, integer type)<br>
+
|delay=0|function_syntax=list osGetLinkInventoryNames(integer linkNumber, integer type)<br>
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 +
// Example for osGetLinkInventoryNames
 +
// This script uses the osGetLinkInventoryNames function to return a list of inventory items of a specified type in a specified child prim
 +
 +
// Define the child prim
 +
integer CHILD_PRIM_NUMBER = 2;
 +
// Define the inventory type
 +
integer INVENTORY_TYPE = INVENTORY_ALL;
 +
 +
// Event handler, that is executed on script start
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        // Get the list of inventory items by name
 +
        list inventoryNames = osGetLinkInventoryNames(CHILD_PRIM_NUMBER, INVENTORY_TYPE);
 +
 +
        // Check if the list contains items
 +
        if (llGetListLength(inventoryNames) > 0)
 +
        {
 +
            // Go through the list and output the names to owner chat
 +
            integer numItems = llGetListLength(inventoryNames);
 +
            string itemNames = "Inventory items:\n";
 +
            integer i;
 +
            for (i = 0; i < numItems; ++i)
 +
            {
 +
                string itemName = llList2String(inventoryNames, i);
 +
                itemNames += itemName + "\n";
 +
            }
 +
            llOwnerSay(itemNames);
 +
        }
 +
        else
 +
        {
 +
            // If nothing is found indicate as such
 +
            llOwnerSay("The inventory of the child prim is empty or does not contains items of this inventory type");
 +
        }
 +
    }
 +
}
 
</source>
 
</source>
 
|description=
 
|description=
 
Return a list of items names by type (or INVENTORY_ALL) located in a child prim inventory.
 
Return a list of items names by type (or INVENTORY_ALL) located in a child prim inventory.
 +
List ordering is arbitrary. Successive calls may return different orders.
 
|additional_info=This function was added in 0.9.3.0
 
|additional_info=This function was added in 0.9.3.0
 
}}
 
}}

Latest revision as of 04:59, 29 March 2024

list osGetLinkInventoryNames(integer linkNumber, integer type)
Return a list of items names by type (or INVENTORY_ALL) located in a child prim inventory.

List ordering is arbitrary. Successive calls may return different orders.

Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
// Example for osGetLinkInventoryNames
// This script uses the osGetLinkInventoryNames function to return a list of inventory items of a specified type in a specified child prim
 
// Define the child prim
integer CHILD_PRIM_NUMBER = 2;
// Define the inventory type
integer INVENTORY_TYPE = INVENTORY_ALL;
 
// Event handler, that is executed on script start
default
{
    state_entry()
    {
        // Get the list of inventory items by name
        list inventoryNames = osGetLinkInventoryNames(CHILD_PRIM_NUMBER, INVENTORY_TYPE);
 
        // Check if the list contains items
        if (llGetListLength(inventoryNames) > 0)
        {
            // Go through the list and output the names to owner chat
            integer numItems = llGetListLength(inventoryNames);
            string itemNames = "Inventory items:\n";
            integer i;
            for (i = 0; i < numItems; ++i)
            {
                string itemName = llList2String(inventoryNames, i);
                itemNames += itemName + "\n";
            }
            llOwnerSay(itemNames);
        }
        else
        {
            // If nothing is found indicate as such
            llOwnerSay("The inventory of the child prim is empty or does not contains items of this inventory type");
        }
    }
}
Notes
This function was added in 0.9.3.0


Personal tools
General
About This Wiki