# TLO:Achievement

Provides access to achievements.

## Forms

| Type                                                                                             | Form                      | Description                                                                            |
| ------------------------------------------------------------------------------------------------ | ------------------------- | -------------------------------------------------------------------------------------- |
| [*achievement*](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievement.md) | **Achievement\[#\|Name]** | Look up an achievement by name or by id.                                               |
| [*achievementmgr*](#achievementmgr-type)                                                         | **Achievement**           | Access the achievement manager which provides access to information about achievements |

## AchievementMgr Type

Provides access achievements, achievement categories, and other information surrounding the achievement system.

| Type                                                                                                   | Name                      | Description                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [*achievement*](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievement.md)       | **Achievement\[#\|Name]** | Find an achievement by its ID or by its name.                                                                                                          |
| [*achievement*](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievement.md)       | **AchivementByIndex\[#]** | Find an achievement by its index.                                                                                                                      |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                       | **AchivementCount**       | The number of achievements in the manager.                                                                                                             |
| [*achievementcat*](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievementcat.md) | **Category\[#\|Name]**    | Find an achievement category by its id or by its name.Note: If searching by name, only top-level categories are returned from the achievement manager. |
| [*achievementcat*](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievementcat.md) | **CategoryByIndex\[#]**   | Find an achievement category by its index.                                                                                                             |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                       | **CategoryCount**         | The number of achievement categories in the manager.                                                                                                   |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                       | **Points**                | The total number of accumulated achievement points.                                                                                                    |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                       | **CompletedAchivements**  | The number of completed achievements.                                                                                                                  |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)                       | **TotalAchivements**      | The number of available achievements.                                                                                                                  |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)                     | **Ready**                 | Indicates that the manager has loaded all achievement data and is ready to be used.                                                                    |

## Usage

!!! warning Looking up achievements by name may not always return the correct achievement if multiple exist with the same name. Achievement IDs should be preferred over names as they don't change and are unique.

**Achievement\[**#**]** and **Achievement.Achievement\[**#**]** are equivalent and are provided for consistency. The primary way to access achievement information should be via id. Achievement IDs are unique and do not change.

To look up an achievement's ID, you can look up an achievement by name, or you can use the Achievements Inspector.

#### ‌Note About Achievement Indices

Achievements and categories can be looked up by index. This is significantly faster than looking up by id or name. However, these indices are **not** stable and will change from patch to patch, but they will not change during the session. If an achievement is being utilized in a script many times, it may be more performant to look up an achievement's index (with its .Index member) and then use that in subsequent queries.

See [Achievement Examples](/macroquest/data-types-and-top-level-objects/data-types/datatype-achievement.md#examples) for some examples of using indices for looking up achievements.

### Examples

In the following example, we will look up an achievement by name, and then print its ID.

\=== "MQScript"

````
```text
/echo ${Achievement[Master of Claws of Veeshan].ID}
```
````

\=== "Lua"

````
```lua
print(mq.TLO.Achievement("Master of Claws of Veeshan").ID())
```
````

In the following example, we will print the completed status of achievement "**Wayfarers Brotherhood Adventurer's Stone (Various 20+)**"

\=== "MQScript"

````
```
/echo ${Achievement[500980300].Completed}
```
````

\=== "Lua"

````
```lua
print(mq.TLO.Achievement(500980300).Completed())
```
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://macroquest.gitbook.io/macroquest/data-types-and-top-level-objects/top-level-objects/tlo-achievement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
