# XPBar Methods to interact with the XP bar. - - - ## ERSXPBarSize ```pascal ERSXPBarSize = enum(UNKNOWN, SMALL, MEDIUM, LARGE); ``` Enum reprensenting the {ref}`XPBar` available sizes. - - - ## ERSXPBarPosition ```pascal ERSXPBarPosition = enum(UNKNOWN, LEFT, CENTER, RIGHT); ``` Enum reprensenting the {ref}`XPBar` available positions. - - - ## TRSXPBar Record responsible with interacting with the {ref}`XPBar`. - - - ## XPBar.UpdateSize ```pascal procedure TRSXPBar.UpdateSize(); ``` Internal method used to update the {ref}`TRSXPBar` coordinates. This is automatically called for you on the {ref}`XPBar variable`. - - - ## XPBar.SetupInterface ```pascal procedure TRSXPBar.SetupInterface(); ``` Internal method used to setup the {ref}`TRSXPBar` coordinates and core values. This is automatically called for you on the {ref}`XPBar variable`. - - - ## XPBar.IsOpen ```pascal function TRSXPBar.IsOpen(): Boolean; ``` Checks if the XPBar circle is enabled. This does not mean that the XPBar is actually visible, simply that according to the XPBar circle, it is enabled. Example: ```pascal WriteLn XPBar.IsEnabled(); ``` - - - ## XPBar.WaitOpen ```pascal function TRSXPBar.WaitOpen(): Boolean; ``` Waits for the XPBar to be open. This does not mean that the XPBar is actually visible, simply that according to the XPBar button, it is enabled. Example: ```pascal WriteLn XPBar.WaitOpen(); ``` - - - ## XPBar.Open ```pascal function TRSXPBar.Open(): Boolean; ``` Opens the XPBar by clicking the XPBar circle. Example: ```pascal if not XPBar.IsOpen() then WriteLn XPBar.Open(); ``` - - - ## XPBar.Close ```pascal function TRSXPBar.Close(): Boolean; ``` Closes the XPBar by clicking the XPBar circle. Example: ```pascal if XPBar.IsOpen() then WriteLn XPBar.Close(); ``` - - - ## XPBar.Setup ```pascal function TRSXPBar.Setup(): Boolean; ``` Internal method automatically called by WaspLib once when attempting to read the XPBar. Should only ever run once. - - - ## XPBar.Read ```pascal function TRSXPBar.Read(): Integer; ``` Reads the XP in the XPBar. Example: ```pascal WriteLn XPBar.Read(); ``` - - - ## XPBar.EarnedXP ```pascal function TRSXPBar.EarnedXP(): Boolean; ``` Returns True/False if we earned XP since the last time this, XPBar.Read() or XPBar.WaitXP() were called. Example: ```pascal while True do WriteLn XPBar.EarnedXP(); ``` - - - ## XPBar.WaitXP ```pascal function TRSXPBar.WaitXP(time: Integer = 600; interval: Integer = -1): Boolean; ``` Waits a set amount of time until XPBar.EarnedXP() is true. - - - ## XPBar.TotalEarnedXP ```pascal function TRSXPBar.TotalEarnedXP(update: Boolean = False): UInt64; ``` Returns the total amount of earned experience tracked since the script started running. This is pretty reliable but should be taken with a grain of salt since XPBar can be misread due to several reasons, like open interfaces. - - - ## XPBar variable Global {ref}`TRSXPBar` variable.