WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   verify achievement (https://www.wowinterface.com/forums/showthread.php?t=43507)

Caetan0 06-04-12 02:18 PM

verify achievement
 
friends, You know you tell me if there are any command line that checks if the player possesses certain achievement?

Phanx 06-05-12 12:22 AM

You can find a list of all achievement-related WoW API functions here:
http://www.wowpedia.org/World_of_Warcraft_API#Achievement_Functions

I highly recommend you bookmark the following page, which contains links to the above page and many other helpful references for WoW API functions, events, and more:
http://www.wowpedia.org/Portal:Interface_customization

For your specific question, the function you want is GetAchievementInfo, which takes the achievement ID (the number in the achievement's URL on wowhead.com) and returns lots of information about the achievement. The fourth return value is a boolean (true/false) value indicating whether or not you have completed the achievement.

For example, this command:
Code:

/run local _, name, _, completed = GetAchievementInfo(4826) print(string.format("%s is %s.", name, completed and "complete" or "not complete"))
...will print "Level 85 is complete." if you've completed the Level 85 achievement or "Level 85 is not complete." if you haven't.

Really, though, I can't see this being very useful. You should already have a general idea of which achievements you've completed, and if you're not sure, it's probably faster to just find it in the Achievements window than to go find its ID number and use a /run command.

Also, there are plenty of addons that will show you whether you've completed an achievement when you're looking at a tooltip for the achievement (eg. if you click on the achievement link in chat).

If you're looking for ways to see if another player (not yourself) has completed an achievement, you would need to use the the inspect API, not the achievement API. However, as the inspect API is very complicated, very fragile, and somewhat buggy, I would absolutely not recommend trying to work with it for a beginner, and am not going to provide any help with it. I'd suggest using an addon like Examiner for this.

Caetan0 06-05-12 12:56 PM

Thank you my friend, What I am "trying" to do is check one of conquest and if the player in my guild has this achievement it will be promoted to the rank 9.

Code:

        if rank >= 9 then
            if level == 85 and completed == GetAchievementInfo(399) then
                if reallyPromote then
                    SetGuildMemberRank(i, 9)
                end
            end
        end

In case, the guild member is promoted only if it has completed the conquest of "Just the Two of Us: 1550." The code is right?

unlimit 06-05-12 05:45 PM

Quote:

Originally Posted by Caetan0 (Post 256679)
Thank you my friend, What I am "trying" to do is check one of conquest and if the player in my guild has this achievement it will be promoted to the rank 9.

As Phanx said, this would require you to use the inspect API, not the achievement API.

Quote:

Originally Posted by Phanx (Post 256677)
If you're looking for ways to see if another player (not yourself) has completed an achievement, you would need to use the the inspect API, not the achievement API. However, as the inspect API is very complicated, very fragile, and somewhat buggy, I would absolutely not recommend trying to work with it for a beginner, and am not going to provide any help with it. I'd suggest using an addon like Examiner for this.

Something like this seems kind of like a waste of time, why not just have them link you the achievement when they get it, then you promote them?

Phanx 06-05-12 07:03 PM

Quote:

Originally Posted by Caetan0 (Post 256679)
... check one of conquest and if the player in my guild has this achievement it will be promoted to the rank 9. ... The code is right?

No. You did not read my entire post. The function I gave an example for only works for yourself. I clearly stated that if you want to get information about other players' achievements you must use the inspection API, which is a separate set of functions and events.

Also, it is only possible to inspect characters which are within ~15 yards of your character, so what you are describing is not possible.

This is why you should always describe your request clearly and completely. If you had explained what you wanted to do in the first place, I would have just told you it wasn't possible, instead of wasting my time writing a long explanation with code examples and links to resources.


All times are GMT -6. The time now is 03:15 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI