OsGetInventoryItemKey
From OpenSimulator
(Difference between revisions)
Line 60: | Line 60: | ||
|description=Returns id(key) of a inventory item within a prim inventory.<br> If name is not unique result maybe unpredictable.<br> Note that unlike this function, llGet*InventoryItemKey do not return the item ID but the ID of its asset.<br>Returns NULL_KEY if the item is not found or Owner has no rights | |description=Returns id(key) of a inventory item within a prim inventory.<br> If name is not unique result maybe unpredictable.<br> Note that unlike this function, llGet*InventoryItemKey do not return the item ID but the ID of its asset.<br>Returns NULL_KEY if the item is not found or Owner has no rights | ||
|additional_info=osGetInventoryItemKey added in 0.9.1.0 Dev, Implemented August, 16 2019 <br> | |additional_info=osGetInventoryItemKey added in 0.9.1.0 Dev, Implemented August, 16 2019 <br> | ||
− | osGetLinkInventoryKey added in 0.9.3.0 Dev, | + | osGetLinkInventoryKey added in 0.9.3.0 Dev, March 2024 |
}} | }} | ||
'''See Also:''' | '''See Also:''' |
Revision as of 10:55, 5 March 2024
key osGetInventoryItemKey(string name)
key osGetLinkInventoryItemKey(integer linkNumber, string name) | |
Returns id(key) of a inventory item within a prim inventory. If name is not unique result maybe unpredictable. Note that unlike this function, llGet*InventoryItemKey do not return the item ID but the ID of its asset. Returns NULL_KEY if the item is not found or Owner has no rights | |
Threat Level | This function does not do a threat level check |
Permissions | Script owner needs modify, copy and transfer rights |
Extra Delay | 0 seconds |
Example(s) | |
// // osGetInventoryItemKey Script Exemple // Author: Ubit // default { state_entry() { llSay(PUBLIC_CHANNEL, "Touch me to see osGetInventoryItemKey usage."); } touch_start(integer number) { key ItemKey = osGetInventoryItemKey("MyItemName"); if (ItemKey != NULL_KEY)llSay(PUBLIC_CHANNEL, "Item key is " + osGetInventoryDesc(ItemKey)); else llSay(PUBLIC_CHANNEL, "The item key is a NULL_KEY, item not found or owner has no rights ..."); } } // Example for osGetLinkInventoryItemKey // This script uses the osGetLinkInventoryKey function to fetch the key of a specified inventory item in a specified child prim // Define the child prim integer CHILD_PRIM_NUMBER = 2; // Define the inventory item name string itemName = "INVENTORY_ITEM_NAME"; // Event handler, that is executed on script start default { state_entry() { // Get the key of the inventory item by name in child prim key itemUUID = osGetLinkInventoryItemKey(CHILD_PRIM_NUMBER, itemName); // Check if the returned key is not NULL_KEY if (itemUUID != NULL_KEY) { // Output the key to owner chat llOwnerSay("UUID of the inventory item '" + itemName + "': " + (string)itemUUID); } else { // If the key is NULL_KEY then the item was not found llOwnerSay("No inventory item named '" + itemName + "' was found"); } } } | |
Notes | |
osGetInventoryItemKey added in 0.9.1.0 Dev, Implemented August, 16 2019 osGetLinkInventoryKey added in 0.9.3.0 Dev, March 2024 |
See Also: