PDA

View Full Version : Addon Help Needed Please.


Omega Shenron
05-02-2007, 06:40 AM
I'm trying to sort out code and am new at all this. My problem is that I'm trying to fix an error in a mod that counts items in your inventory and it works fine, however when it comes to the items Iron and Dark Iron, Runeclothe and Runecloth Bandages, It counts these items as a single item.

eg: 3 Runecloth and 23 Runcloth Bandages = 26 Runecloth and 26 Runecloth bandages.

Iron and Dark Iron do the same thing as do others. Can someone please help me sort out the count function so it isolates each item as a single....ie: exact word or name search. I am totally confused and lost. The search code is shown below. Thank you in advance.

-- Item count function
function TitanPanelOre_CountItem(item_id)
local nbslots, b, s, t, n;
local i_count = 0;

for b=0,4 do
nbslots=GetContainerNumSlots(b);
for s=0,nbslots do
local texture, itemCount = GetContainerItemInfo(b, s);
t = GetContainerItemLink(b, s);
if (t) and (string.find(t, item_id)) then
i_count = i_count + itemCount;
end
end
end
return i_count;
end