OsGetInventoryItemKey

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
 
Line 9: Line 9:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llSay(PUBLIC_CHANNEL, "Touch me to show osGetInventoryDesc");
+
         llOwnerSay("Touch me to show osGetInventoryDesc");
 
     }
 
     }
  
     touch_start(integer n)
+
     touch_start(integer number)
 
     {
 
     {
         key uuid = osGetInventoryItemKey("MyNoteCard");
+
         key ItemKey = osGetInventoryItemKey("MyNoteCard");
         llOwnerSay("osGetInventoryDesc(uuid) is " + osGetInventoryDesc(uuid));
+
         if (ItemKey != NULL_KEY) llOwnerSay(osGetInventoryDesc(ItemKey));
     }
+
        else llOwnerSay("ItemKey is a NULL_KEY, item not found or owner has no rights ...");
 +
     }  
 
}
 
}
 
</source>
 
</source>

Latest revision as of 15:11, 16 August 2019

key osGetInventoryItemKey(string name)
Returns id(key) of a inventory item within the prim inventory.
If name is not unique result maybe unpredictable.
Note that unlike this function, llGetInventoryKey does 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
Delay 0 seconds
Example(s)
default
{
    state_entry()
    {
        llOwnerSay("Touch me to show osGetInventoryDesc");
    }
 
    touch_start(integer number)
    {
        key ItemKey = osGetInventoryItemKey("MyNoteCard");
        if (ItemKey != NULL_KEY) llOwnerSay(osGetInventoryDesc(ItemKey));
        else llOwnerSay("ItemKey is a NULL_KEY, item not found or owner has no rights ...");
    }   
}
Notes
This function was added in 0.9.1.0 Dev

Implemented August, 16 2019


Personal tools
General
About This Wiki