# Achievements This page is dedicated to the achievements game tab and methods to interact with it. ```{figure} ../../images/achievements.png ``` - - - ## EAchievementTab ```pascal EAchievementTab = enum(SUMMARY, QUESTS, DIARIES); ``` An enum representing each of the {ref}`Achievements` gametab tabs. - - - ## EAchievementDiary ```pascal EAchievementDiary = enum( ARDOUGNE, DESERT, FALADOR, FREMENNIK, KANDARIN, KARAMJA, KOUREND_AND_KEBOS, LUMBRIDGE_AND_DRAYNOR, MORYTANIA, VARROCK, WESTERN_PROVINCES, WILDERNESS ); ``` An enum representing each of the achievement diaries available. - - - ## TAchievementsSummary Helper record used to interact with the {ref]`Achievements` gametab "Summary" tab: ```{figure} ../../images/achievements.png ``` - - - ## TAchievementsSummary.SetupGameTab ```pascal procedure TAchievementsSummary.SetupGameTab(); ``` Internal method used to setup {ref]`TAchievementsSummary` coordinates. This is automatically called for you on the `Achievements.Summary variable`. - - - ## TQuestList Helper record used to interact with the {ref]`Achievements` gametab "Quests" tab: ```{figure} ../../images/achievements_quests.png ``` - - - ## TQuestList.SetupGameTab ```pascal procedure TQuestList.SetupGameTab(); ``` Internal method used to setup {ref]`TQuestList` coordinates. This is automatically called for you on the `Achievements.Quests variable`. - - - ## TDiarySlot Helper record used to interact with a {ref}`TDiaryList` slot. - - - ## TDiaryList Helper record used to interact with the {ref]`Achievements` gametab "Diaries" tab: ```{figure} ../../images/achievements_diaries.png ``` - - - ## TDiaryList.SetupGameTab ```pascal procedure TDiaryList.SetupGameTab(); ``` Internal method used to setup {ref]`TDiaryList` coordinates. This is automatically called for you on the `Achievements.Diaries variable`. - - - ## TDiaryList.GetSlots ```pascal function TDiaryList.GetSlots(): array of TDiarySlot; ``` Returns the slots available in the diary tab as an array of {ref}`TDiarySlot`. Example: ```pascal img := Target.GetImage(); for slot in Achievements.Diaries.GetSlots() do begin img.DrawColor := $FFFFFF; img.DrawBox(slot.Bounds); img.DrawColor := $00FFFF; img.DrawBox(slot.Name); img.DrawColor := $FF00FF; img.DrawBox(slot.Number); img.DrawColor := $FFFF00; img.DrawBoxArray(slot.Levels, False); end; img.Show(); img.Free(); ``` ```{figure} ../../images/diary_slots.png ``` - - - ## TDiaryList.GetSlot ```pascal function TDiaryList.GetSlot(diary: EAchievementDiary): TDiarySlot; ``` Returns the slot of the specified `diary` as a {ref}`TDiarySlot`. Example: ```pascal img := Target.GetImage(); slot := Achievements.Diaries.GetSlot(EAchievementDiary.FREMENNIK); img.DrawColor := $FFFFFF; img.DrawBox(slot.Bounds); img.DrawColor := $00FFFF; img.DrawBox(slot.Name); img.DrawColor := $FF00FF; img.DrawBox(slot.Number); img.DrawColor := $FFFF00; img.DrawBoxArray(slot.Levels, False); img.Show(); img.Free(); ``` ```{figure} ../../images/diary_slot.png ``` - - - ## TDiaryList.ScrollTo ```pascal procedure TDiaryList.ScrollTo(diary : EAchievementDiary); ``` Scrolls to the specified `diary`. Example: ```pascal Achievements.Diaries.ScrollTo(EAchievementDiary.MORYTANIA); ``` - - - ## TAchievements Main record used to interact with the {ref]`Achievements` gametab. Each tab has it's own specific variable: - `TAchievements.Summary: TAchievementsSummary` - `TAchievements.Quests: TQuestList` - `TAchievements.Diaries: TDiaryList` So if you want to use {ref}`TDiaryList.GetLevel` for example you would do this: ```pascal WriteLn Achievements.Diaries.GetLevel(EAchievementDiary.ARDOUGNE); ``` - - - ## Achievements.SetupGameTab(); ```pascal procedure TAchievements.SetupGameTab(); ``` Internal method used to setup the {ref}`TAchievements` coordinates. This is automatically called for you on the {ref}`Achievements variable`. - - - ## Achievements.IsOpen ```pascal function TAchievements.IsOpen(): Boolean; ``` Returns true/false if the inventory is open. Example: ```pascal WriteLn Achievements.IsOpen(); ``` - - - ## Achievements.Open ```pascal function TAchievements.Open(): Boolean; ``` Attempts to open the inventory gametab. Example: ```pascal WriteLn Achievements.Open(); ``` - - - ## Achievements Tabs The {ref}`Achievements` tabs are dynamic as one of them can be hidden away on certain types of accounts: ![3 tabs](../../images/achievements_tabs3.png) ![4 tabs](../../images/achievements_tabs4.png) To handle this, you have the 2 following methods, they are used automatically for you on the {ref}`Achievements variable`. - - - ### Achievements.CountTabs ```pascal function TAchievements.CountTabs(): Integer; ``` Internal method used to count the available tabs on the {ref}`Achievements` gametab. - - - ### Achievements.SetupTabs ```pascal procedure TAchievements.SetupTabs(); ``` Internal method used to update the coordinates of the tabs on the {ref}`Achievements` gametab. This is automatically used for you. - - - ## Achievements.GetTab ```pascal function TAchievements.GetTab(): EAchievementTab; ``` Returns the currently active {ref}`EAchievementTab`. Example: ```pascal WriteLn Achievements.GetTab(); ``` - - - ## Achievements.OpenTab ```pascal function TAchievements.OpenTab(tab: EAchievementTab): Boolean; ``` Attempts to open the specified `tab` {ref}`EAchievementTab`. Example: ```pascal WriteLn Achievements.OpenTab(EAchievementTab.DIARIES); ``` - - - ## Achievements variable Global {ref}`TAchievements` variable. - - - ## TDiaryList.GetLevel ```pascal function TDiaryList.GetLevel(diary: EAchievementDiary): Integer; ``` Returns the current completion level of the specified `diary`. The level will be between -1 and 4. -1 is returned if we fail. Example: ```pascal WriteLn Achievements.Diaries.GetLevel(EAchievementDiary.MORYTANIA); ```