# XPBar Methods to interact with the XP bar. - - - ## TXPBar Record responsible with interacting with the {ref}`XPBar`. - - - ## XPBar.SetupInterface ```pascal procedure TXPBar.SetupInterface(); ``` Internal method used to setup the {ref}`TXPBar` coordinates and core values. This is automatically called for you on the {ref}`XPBar variable`. - - - ## XPBar.IsOpen ```pascal function TXPBar.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 TXPBar.WaitOpen(time: Integer = TICK; interval: Integer = -1): 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 TXPBar.Open(): Boolean; ``` Opens the XPBar by clicking the XPBar circle. Example: ```pascal if not XPBar.IsOpen() then WriteLn XPBar.Open(); ``` - - - ## XPBar.Close ```pascal function TXPBar.Close(): Boolean; ``` Closes the XPBar by clicking the XPBar circle. Example: ```pascal if XPBar.IsOpen() then WriteLn XPBar.Close(); ``` - - - ## XPBar.Setup ```pascal function TXPBar.Setup(): Boolean; ``` Internal method automatically called by WaspLib once when attempting to read the XPBar. Should only ever run once. - - - ## XPBar.Read ```pascal function TXPBar.Read(): UInt64; ``` Reads the XP in the XPBar. Example: ```pascal WriteLn XPBar.Read(); ``` - - - ## XPBar.EarnedXP ```pascal function TXPBar.EarnedXP(): Boolean; ``` Returns True/False if we earned XP since the last time this, {ref}`XPBar.Read` or {ref}`XPBar.WaitXP` were called. When this returns true it also resets {ref}`Activity`. Example: ```pascal while True do WriteLn XPBar.EarnedXP(); ``` - - - ## XPBar.WaitXP ```pascal function TXPBar.WaitXP(time: Integer = TICK; interval: Integer = -1): Boolean; ``` Waits a set amount of time until XPBar.EarnedXP() is true. - - - ## XPBar.TotalEarnedXP ```pascal function TXPBar.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}`TXPBar` variable.