/// <summary> /// Lookup a task inventory item AssetID by item name /// </summary> /// <param name="script">Calling script</param> /// <param name="name">Name of an inventory item</param> /// <returns>AssetID, or UUID.Zero if the item was not found in prim /// inventory</returns> private UUID InventoryKey(IScriptInstance script, string name) { if (script.Host is LLPrimitive) { PrimInventory inventory = ((LLPrimitive)script.Host).Inventory; LLInventoryTaskItem item = inventory.FindItem(delegate(LLInventoryTaskItem match) { return(match.Name == name); }); if (item != null) { return(item.AssetID); } } return(UUID.Zero); }
/// <summary> /// Lookup the given script's AssetID /// </summary> /// <param name="script">Calling script</param> /// <returns>AssetID, or UUID.Zero if something went wrong</returns> protected UUID InventorySelf(IScriptInstance script) { if (script.Host is LLPrimitive) { PrimInventory inventory = ((LLPrimitive)script.Host).Inventory; LLInventoryTaskItem item = inventory.FindItem(delegate(LLInventoryTaskItem match) { return(match.ID == script.ID); }); if (item != null) { return(item.AssetID); } } return(UUID.Zero); }