View Single Post
04/24/14, 07:42 AM   #3
Asto
 
Asto's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
1
Weird... They should name the method so but for me it doesn't make sense to return only completed achievements.

Well what i wanted to do: if the event EVENT_ACHIEVEMENT_UPDATED is thrown i get all events with the same progress criterion that got updated. In the most cases the achievements are on the same line, so i just wanted to show only the next achievable achievement.

I tried to check if there is a previous achievement and the previous achievement in the line is also incomplete, i wanted to ignore the event. So that my handler starts handling only when
1. there is no previous achievement and the one updated (this one) is incomplete
2. there is a previous achievement but that one is complete and this updated one is incomplete

At the moment i cannot differentiate between those cases. I could check if GetPreviousAchievementInLine returns 0. Works great for achievement lines. If it returns 0, i can ignore it because the previous one ins incomplete. The previous one may return a achievementId beceause the first achievement in the line is complete, so its perfect.

But i run into problems when i try to use this on the first achievement in the line or on achievements without a line. They also return 0 and i can't ignore them because they they just have no previous achievements

i hope you can understand my problem :/

2
I am listening to the event
Lua Code:
  1. -- Register Events
  2.     AchievementInfo.registerEvent(EVENT_ACHIEVEMENT_UPDATED, AchievementInfo.onAchievementUpdated)

And let's say my handler looks like
Lua Code:
  1. function AchievementInfo.onAchievementUpdated(eventCode, achId)
  2.     d(achId) -- for example 41, 67, ...
  3.  
  4.     d("- GetCatInfo")
  5.     d(GetCategoryInfoFromAchievementId(achId))
  6.     local a, b, c = GetCategoryInfoFromAchievementId(achId)
  7.  
  8.     d("- getAId")
  9.     d(GetAchievementId(a, b, c)) -- for example 41, but not 67, ... !?
  10. end

i get the following results when harvesting wood for example, where 67 and 68 are the last two harvester achievements ( http://esohead.com/achievements/67-node-harvester-iv and http://esohead.com/achievements/68-node-harvester-v ) that get updated when harvesting sth... Achievement ID 41 in the screens below is the achievement for slaying plants... that works correct

The main problem is: i want to get the category name of the achievements. Works fine with achId 38 or 41 when slaying humanoids or plants
Lua Code:
  1. local categoryTopLevelIndex = GetCategoryInfoFromAchievementId(achId)
  2. local catName = GetAchievementCategoryInfo(categoryTopLevelIndex)

but not for the node harvester achievements for example. because it returns the 2, nil, 2 thing. 2 is not the crafting category...

PS: I get the same 2, nil, 2 results for achId 65 and 66, hmm
Attached Thumbnails
Click image for larger version

Name:	68.jpg
Views:	502
Size:	8.0 KB
ID:	183  
Attached Images
  

Last edited by Asto : 04/24/14 at 08:00 AM.
  Reply With Quote