# DataType:achievementobj

Represents a single objective of an achievement

## Members

| **Type**                                                                               | **Member**        | **Description**                                                                                                          |
| -------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **ID**            | The objective's unique ID.                                                                                               |
| [*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md) | **Description**   | Text describing this objective.                                                                                          |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Count**         | The current count recorded by the objective.                                                                             |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **RequiredCount** | The total count required to be complete the objective. For objectives that don't require a count, this will be zero.     |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)     | **Completed**     | True if the objective has been completed.                                                                                |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Index**         | Visual index of the objective as displayed in the achievement window. Can be used with **Achievement.ObjectiveByIndex**. |

### Example

List the objectives that are still left to complete the achievement "**Norrathian Explorer**":

{% tabs %}
{% tab title="MQScript" %}

```
/declare ach achievement local Norrathian Explorer

/if (${ach.Completed}) {
    /echo ${ach.Name} is complete!
} else {
    /echo The following objectives for ${ach.Name} are incomplete:
    /declare i int local
    /for i 1 to ${ach.ObjectiveCount} {
        /if (!${ach.ObjectiveByIndex[${i}].Completed}) {
            /echo ${ach.ObjectiveByIndex[${i}].Description}
        }
        /next i
    }
}
```

{% endtab %}

{% tab title="Lua" %}

```lua
local achievement = mq.TLO.Achievement('Norrathian Explorer')

if achievement.Completed() then
    print(string.format('%s complete!', achievement.Name()))
else
    print(string.format('The following objectives for %s are incomplete:', achievement.Name()))
    for i = 1, achievement.ObjectiveCount() do
        local objective = achievement.ObjectiveByIndex(i)
        if not objective.Completed() then
            print(achievement.ObjectiveByIndex(i).Description())
        end
    end
end
```

{% endtab %}
{% endtabs %}


---

# 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/data-types/datatype-achievementobj.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.
