OsGetLinkInventoryName

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
m
Line 38: Line 38:
 
|additional_info=This function was added in 0.9.3.0
 
|additional_info=This function was added in 0.9.3.0
  
<br/>
 
  
osGetLinkInventoryName (linkNumber, itemId) is '''not''' an extension<br/>
+
osGetLinkInventoryName (linkNumber, itemId) is '''not''' an extension of llGetInventoryName (integer type, integer number) to links.<br/>
of llGetInventoryName (integer type, integer number) to links.<br/>
+
To extend llGetInventoryName (type, number) to links, we must callosGetLinkInventoryNames (note the final 's') to get the list of<br/>
To extend llGetInventoryName (type, number) to links, we must call<br/>
+
inventory names for this type, sort the list, then extract the item a index 'number'.<br/>
osGetLinkInventoryNames (note the 's') to get the list of inventory names<br/>
+
for this type, sort the list, then extract the item a index 'number'.<br/>
+
  
 
<source lang="lsl">
 
<source lang="lsl">

Revision as of 09:43, 18 May 2024

string osGetLinkInventoryName(integer linkNumber, key itemId)
Return the name of an item located in a child prim inventory.
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 osGetLinkInventoryName
// This script uses the osGetLinkInventoryName function to get the name of an inventory item via the key and child prim number
 
// Define the child prim
integer CHILD_PRIM_NUMBER = 2;
// Define the key of the inventory item
key itemUUID = "INVENTORY_ITEM_KEY";
 
// Event handler, that is executed on script start
default
{
    state_entry()
    {
        // Get the inventory item name via its key and the child prim number
        string itemName = osGetLinkInventoryName(CHILD_PRIM_NUMBER, itemUUID);
 
        // Check if the name is not empty
        if (itemName != "")
        {
            // Output the item name to owner chat
            llOwnerSay("Name of the inventory item with UUID " + (string)itemUUID + ": " + itemName);
        }
        else
        {
            // If the name is empty or the item is not found indicate as such
            llOwnerSay("The inventory item with UUID " + (string)itemUUID + " may be empty or not found");
        }
    }
}
Notes
This function was added in 0.9.3.0


osGetLinkInventoryName (linkNumber, itemId) is not an extension of llGetInventoryName (integer type, integer number) to links.
To extend llGetInventoryName (type, number) to links, we must callosGetLinkInventoryNames (note the final 's') to get the list of
inventory names for this type, sort the list, then extract the item a index 'number'.

string myGetLinkInventoryName (integer linkNumber, integer type, integer number)
{
    list names = osGetLinkInventoryNames (linkNumber, type);
    names = llListSort (names, 1, TRUE);
    return llList2String (names, number);
}


Personal tools
General
About This Wiki