public LSL_Integer llGetInventoryNumber(int type) { m_host.AddScriptLPS(1); int count = 0; m_host.TaskInventory.LockItemsForRead(true); foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) { if (inv.Value.Type == type || type == -1) { count = count + 1; } } m_host.TaskInventory.LockItemsForRead(false); return count; }