OsGetInventoryItemKeys
From OpenSimulator
(Difference between revisions)
(Created page with "{{osslfunc |threat_level=ignored |permissions=true |delay=0|function_syntax=list osGetInventoryItemKeys(integer type)<br> list osGetLinkInventoryItemKeys(integer linkNumber, i...") |
JeffKelley (Talk | contribs) m (Note about order) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 42: | Line 42: | ||
} | } | ||
+ | </source> | ||
+ | <source lang="lsl"> | ||
// Example for osGetLinkInventoryItemKeys | // Example for osGetLinkInventoryItemKeys | ||
Line 84: | Line 86: | ||
|description= | |description= | ||
Return a list of the items UUIDs by type (or INVENTORY_ALL) located in the host or child prim prim inventory. | Return a list of the items UUIDs by type (or INVENTORY_ALL) located in the host or child prim prim inventory. | ||
+ | List ordering is arbitrary. Successive calls may return different orders.<br/> | ||
+ | Note that unlike llGetInventoryKey, this function returns the item ID, not ID of its asset. | ||
|additional_info=Added in 0.9.3.0 | |additional_info=Added in 0.9.3.0 | ||
}} | }} |
Latest revision as of 03:59, 29 March 2024
list osGetInventoryItemKeys(integer type)
list osGetLinkInventoryItemKeys(integer linkNumber, integer type) | |
Return a list of the items UUIDs by type (or INVENTORY_ALL) located in the host or child prim 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 osGetInventoryItemKeys // This script uses the osGetInventoryKeys function to return a list of keys based on inventory type // Define the inventory type integer INVENTORY_TYPE = INVENTORY_ALL; // Event handler, that is executed on script start default { state_entry() { // Get the list of keys list itemUUIDs = osGetInventoryItemKeys(INVENTORY_TYPE); // Check if the list contains items if (llGetListLength(itemUUIDs) > 0) { // Go through the list and output it to owner chat integer numItems = llGetListLength(itemUUIDs); string uuidList = "UUIDs of the inventory items:\n"; integer i; for (i = 0; i < numItems; ++i) { string itemUUID = llList2String(itemUUIDs, i); uuidList += itemUUID + "\n"; } llOwnerSay(uuidList); } else { // If the list is empty indicate as such llOwnerSay("Inventory is empty or not items of inventory type were found"); } } } // Example for osGetLinkInventoryItemKeys // This script uses the osGetLinkInventoryItemKeys function to return a list of inventory items from a given child prim // Define the child prim integer CHILD_PRIM_NUMBER = 2; // Define the inventory type to fetch a list of integer INVENTORY_TYPE = INVENTORY_ALL; // Event handler, that is executed on script start default { state_entry() { // Get the list of keys for the inventory items of the child prim list itemUUIDs = osGetLinkInventoryItemKeys(CHILD_PRIM_NUMBER, INVENTORY_TYPE); // Check if the list contains items if (llGetListLength(itemUUIDs) > 0) { // Go through the list and output it to owner chat integer numItems = llGetListLength(itemUUIDs); string uuidList = "Inventory UUIDs:\n"; integer i; for (i = 0; i < numItems; ++i) { string itemUUID = llList2String(itemUUIDs, i); uuidList += itemUUID + "\n"; } llOwnerSay(uuidList); } else { // If there are not returns indicate as such llOwnerSay("There are no items of that inventory type in the child prim"); } } } | |
Notes | |
Added in 0.9.3.0 |