OsGetInventoryItemKey
From OpenSimulator
(Difference between revisions)
Line 4: | Line 4: | ||
|delay=0 | |delay=0 | ||
|function_syntax=key osGetInventoryItemKey(string name)<br> | |function_syntax=key osGetInventoryItemKey(string name)<br> | ||
− | key | + | key osGetLinkInventoryItemKey(integer linkNumber, string name)<br> |
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
Line 28: | Line 28: | ||
− | // Example for | + | // Example for osGetLinkInventoryItemKey |
// This script uses the osGetLinkInventoryKey function to fetch the key of a specified inventory item in a specified child prim | // This script uses the osGetLinkInventoryKey function to fetch the key of a specified inventory item in a specified child prim | ||
Line 42: | Line 42: | ||
{ | { | ||
// Get the key of the inventory item by name in child prim | // Get the key of the inventory item by name in child prim | ||
− | key itemUUID = | + | key itemUUID = osGetLinkInventoryItemKey(CHILD_PRIM_NUMBER, itemName); |
// Check if the returned key is not NULL_KEY | // Check if the returned key is not NULL_KEY | ||
Line 58: | Line 58: | ||
} | } | ||
</source> | </source> | ||
− | |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, | + | |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, Feb 2024 | osGetLinkInventoryKey added in 0.9.3.0 Dev, Feb 2024 | ||
Line 65: | Line 65: | ||
* [[osGetInventoryName]] | * [[osGetInventoryName]] | ||
* [[osGetInventoryDesc]] | * [[osGetInventoryDesc]] | ||
− | |||
* [[osGetInventoryLastOwner]] | * [[osGetInventoryLastOwner]] | ||
* [[osGetLastChangedEventKey]] | * [[osGetLastChangedEventKey]] |
Revision as of 10:54, 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, Feb 2024 |
See Also: