Posted by TheFlyingCorpse on Mon, 05 Apr 2010 01:58:57
I am trying to write a small addon that will calculate some values for me, I started a days ago and have got some basic things working.
A great thanks to the example on how to List everything missing from World Explorer btw ;)
I am however, stuck on trying to print the value that is the number of deaths, if I use the ID of the value etc, the code stops working, no output, no error. I get the ID using the following reference: Reference: http://wowprogramming.com/docs/api/GetStatisticsCategoryList
Thanks in advance for replies, this looks like a great forum :) Best Regards, TheFlyingCorpse
Posted by jnwhiteh on Sat, 21 Aug 2010 16:58:57
Well we can use this to get the category ID for Deaths:
for k,v in pairs(GetStatisticsCategoryList()) do print(v, GetCategoryInfo(v)) end
From that we can see that Deaths is 122. Now we can get the statistics from that category using the following:
for i = 1, GetCategoryNumAchievements(122) do print(GetAchievementInfo(122, i)) end
There's only one statistic in that category. If you want to get into subcategories, you'll need to get a bit more complicated.
catList = GetStatisticsCategoryList(); for idx, catId in ipairs(catList) do local name, parent, flags = GetCategoryInfo(catId) local numStats, numCompleted = GetCategoryNumAchievements(catId) if catId == 122 then for idx = 1, numStats do print(GetAchievementInfo(122, idx)) end elseif parent == 122 then for idx = 1, numStats do print(GetAchievementInfo(catId, idx)) end end end
Hope that helps!