# Achievements This page is dedicated to the achievements game tab and methods to interact with it. ```{figure} ../../images/achievements.png ``` - - - ## ERSAchievementTab ```pascal ERSAchievementTab = enum(SUMMARY, QUESTS, DIARIES); ``` An enum representing each of the {ref}`Achievements` gametab tabs. - - - ## ERSAchievementDiary ```pascal ERSAchievementDiary = 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. - - - ## TRSAchievementsSummary Helper record used to interact with the {ref]`Achievements` gametab "Summary" tab: ```{figure} ../../images/achievements.png ``` - - - ## TRSAchievementsSummary.SetupGameTab ```pascal procedure TRSAchievementsSummary.SetupGameTab(); ``` Internal method used to setup {ref]`TRSAchievementsSummary` coordinates. This is automatically called for you on the `Achievements.Summary variable`. - - - ## TRSQuestList Helper record used to interact with the {ref]`Achievements` gametab "Quests" tab: ```{figure} ../../images/achievements_quests.png ``` - - - ## TRSQuestList.SetupGameTab ```pascal procedure TRSQuestList.SetupGameTab(); ``` Internal method used to setup {ref]`TRSQuestList` coordinates. This is automatically called for you on the `Achievements.Quests variable`. - - - ## TRSDiarySlot Helper record used to interact with a {ref}`TRSDiaryList` slot. - - - ## TRSDiaryList Helper record used to interact with the {ref]`Achievements` gametab "Diaries" tab: ```{figure} ../../images/achievements_diaries.png ``` - - - ## TRSDiaryList.SetupGameTab ```pascal procedure TRSDiaryList.SetupGameTab(); ``` Internal method used to setup {ref]`TRSDiaryList` coordinates. This is automatically called for you on the `Achievements.Diaries variable`. - - - ## TRSDiaryList.GetSlots ```pascal function TRSDiaryList.GetSlots(): array of TRSDiarySlot; ``` Returns the slots available in the diary tab as an array of {ref}`TRSDiarySlot`. 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 ``` - - - ## TRSDiaryList.GetSlot ```pascal function TRSDiaryList.GetSlot(diary: ERSAchievementDiary): TRSDiarySlot; ``` Returns the slot of the specified `diary` as a {ref}`TRSDiarySlot`. Example: ```pascal img := Target.GetImage(); slot := Achievements.Diaries.GetSlot(ERSAchievementDiary.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 ``` - - - ## TRSDiaryList.ScrollTo ```pascal procedure TRSDiaryList.ScrollTo(diary : ERSAchievementDiary); ``` Scrolls to the specified `diary`. Example: ```pascal Achievements.Diaries.ScrollTo(ERSAchievementDiary.MORYTANIA); ``` - - - ## TRSAchievements Main record used to interact with the {ref]`Achievements` gametab. Each tab has it's own specific variable: - `TRSAchievements.Summary: TRSAchievementsSummary` - `TRSAchievements.Quests: TRSQuestList` - `TRSAchievements.Diaries: TRSDiaryList` So if you want to use {ref}`TRSDiaryList.GetLevel` for example you would do this: ```pascal WriteLn Achievements.Diaries.GetLevel(ERSAchievementDiary.ARDOUGNE); ``` - - - ## Achievements.SetupGameTab(); ```pascal procedure TRSAchievements.SetupGameTab(); ``` Internal method used to setup the {ref}`TRSAchievements` coordinates. This is automatically called for you on the {ref}`Achievements variable`. - - - ## Achievements.IsOpen ```pascal function TRSAchievements.IsOpen(): Boolean; ``` Returns true/false if the inventory is open. Example: ```pascal WriteLn Achievements.IsOpen(); ``` - - - ## Achievements.Open ```pascal function TRSAchievements.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 TRSAchievements.CountTabs(): Integer; ``` Internal method used to count the available tabs on the {ref}`Achievements` gametab. - - - ### Achievements.SetupTabs ```pascal procedure TRSAchievements.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 TRSAchievements.GetTab(): ERSAchievementTab; ``` Returns the currently active {ref}`ERSAchievementTab`. Example: ```pascal WriteLn Achievements.GetTab(); ``` - - - ## Achievements.OpenTab ```pascal function TRSAchievements.OpenTab(tab: ERSAchievementTab): Boolean; ``` Attempts to open the specified `tab` {ref}`ERSAchievementTab`. Example: ```pascal WriteLn Achievements.OpenTab( ERSAchievementTab.DIARIES); ``` - - - ## Achievements variable Global {ref}`TRSAchievements` variable. - - - ## TRSDiaryList.GetLevel ```pascal function TRSDiaryList.GetLevel(diary: ERSAchievementDiary): 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(ERSAchievementDiary.MORYTANIA); ```