Currently this function first uses GetItemInfo("name") to get the itemId then searches in bags for the ID.
There are several items with different IDs but the same name (for example, Healthstone).
This function works:
public static int GetItemCount(string itemName) { string countLua = $@" local fullCount = 0; for bag=0,4 do for slot=1,36 do local name = GetContainerItemLink(bag, slot); if (name and name == ""{itemName}"") then local texture, count = GetContaimerItemInfo(bag, slot); fullCount = fullCount + count; end; end; end return fullCount;"; return Lua.LuaDoString<int>(countLua); }
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now