# FairyRing Methods to interact with the Fairy rings interface: ```{figure} ../../images/fairyring.png ``` - - - ## EFairyRingDial ```pascal EFairyRingDial = enum(LEFT, MIDDLE, RIGHT); ``` Enum representing the {ref}`FairyRing` dials available. - - - ## TFairyRing Record responsible with interacting with the {ref}`FairyRing`. - - - ## FairyRing.Setup ```pascal procedure FairyRing.Setup(); ``` Initializes TFairyRing variables. ```{note} This is automatically called on the `FairyRing` variable. ``` - - - ## FairyRing.IsOpen ```pascal function TFairyRing.IsOpen(): Boolean; ``` Returns true/false whether the FairyRing interface is open or not. Example: ```pascal WriteLn FairyRing.IsOpen(); ``` - - - ## FairyRing.WaitOpen ```pascal function TFairyRing.WaitOpen(time: Integer; interval: Integer = -1): Boolean; ``` Returns true if the fairy ring interface is open within `time` milliseconds. Example: ```pascal WriteLn FairyRing.WaitOpen(); ``` - - - ## FairyRing.Close ```pascal function TFairyRing.Close(escape: Boolean): Boolean; function TFairyRing.Close(escapeProbability: Double = BioHash): Boolean; overload; ``` Closes the {ref}`FairyRing` interface, depending on `escape` the function will either press escape or click the close button: ```{figure} ../../images/fairyring_closebtn.png ``` Example: ```pascal WriteLn FairyRing.Close(); ``` - - - ## FairyRing.HandleItem ```pascal function TFairyRing.HandleItem(): Boolean; ``` Magically finds, caches for next usages and equips dramen or lunar staff with the minimum tab opening possible. If no item is found, we will assume the user has the elite lumbridge and draynor diary complete for next uses. Example: ```pascal if FairyRing.HandleItem() then WriteLn FairyRing.Item; ``` - - - ## FairyRing.Open ```pascal function TFairyRing.Open(cuboid: TCuboid): Boolean; ``` Attempts to open the closest fairy ring RSObject. Example: ```pascal WriteLn FairyRing.Open(); ``` - - - ## FairyRing.IsLetterValid ```pascal function TFairyRing.IsLetterValid(letter: Char; dial: EFairyRingDial): Boolean; ``` Checks if the `letter` passed on is valid for the given `dial`. Example: ```pascal WriteLn FairyRing.IsLetterValid('z', EFairyRingDial.LEFT); ``` - - - ## FairyRing.IsCodeValid ```pascal function TFairyRing.IsCodeValid(fairyCode: String): Boolean; ``` Checks if the a given `fairyCode` is a valid fairy ring code. Example: ```pascal WriteLn FairyRing.IsCodeValid('abc'); ``` - - - ## FairyRing.Spin ```pascal procedure TFairyRing.SpinLeft(dial: EFairyRingDial); procedure TFairyRing.SpinRight(dial: EFairyRingDial); ``` Spins the given `dial` left or right. Example: ```pascal WriteLn FairyRing.SpinLeft(EFairyRingDial.LEFT); ``` If you want, you can see the left and right dial blick boxes with the following code: ```pascal {$I WaspLib/main.simba} begin ShowOnTarget(FairyRing.RotateLeftBoxes + FairyRing.RotateRightBoxes); end. ``` ```{figure} ../../images/fairyring_dialspinboxes.png ``` - - - ## FairyRing.Letter ```pascal property TFairyRing.Letter(dial: EFairyRingDial): Char; property TFairyRing.Letter(character: Char; dial: EFairyRingDial): Boolean; ``` Returns or sets the letter of a fairy ring dial. Example: ```pascal WriteLn FairyRing.Letter[EFairyRingDial.RIGHT]; WriteLn FairyRing.Letter['p', EFairyRingDial.RIGHT]; WriteLn FairyRing.Letter[EFairyRingDial.RIGHT]; ``` The letter in question that will be read or set is the one that is in the dial "hole": ```pascal {$I WaspLib/main.simba} begin ShowOnTarget(FairyRing.DialHoles); end. ``` ```{figure} ../../images/fairyring_dialholes.png ``` - - - ## FairyRing.Code ```pascal property TFairyRing.Code: String; property TFairyRing.Code(code: String): Boolean; ``` Returns the current fairy ring code or sets the new one in the dials. Example: ```pascal WriteLn FairyRing.Code; WriteLn FairyRing.Code['DLP']; WriteLn FairyRing.Code; ``` - - - ## FairyRing.ClickTeleport ```pascal function TFairyRing.ClickTeleport(): Boolean; ``` Clicks the fairy ring the teleport button: ```{figure} ../../images/fairyring_teleportbtn.png ``` Example: ```pascal WriteLn FairyRing.ClickTeleport(); ``` - - - ## FairyRing TravelLog This next section is about the fairy ring travel log {ref}`GameTab` menu: ```{figure} ../../images/fairyring_travellog.png ``` - - - ### FairyRing.GetLogCodes ```pascal function TFairyRing.GetLogCodes(out boxes: TBoxArray): TStringArray; function TFairyRing.GetLogCodes(): TStringArray; overload; ``` Returns the visible codes in the fairy ring travel log. Example: ```pascal {$I WaspLib/main.simba} var logs: TStringArray; boxes: TBoxArray; begin logs := FairyRing.GetLogCodes(boxes); if logs <> [] then begin WriteLn logs; ShowOnTarget(boxes); end; end. ``` ```{figure} ../../images/fairyring_logs.png ``` - - - ### FairyRing.FindLogCode ```pascal function TFairyRing.FindLogCode(code: String; out b: TBox): Boolean; function TFairyRing.FindLogCode(code: String): Boolean; overload; ``` Finds the code specified in the travel log. Codes casing is ignored. Example: ```pascal {$I WaspLib/main.simba} var b: TBox; begin if FairyRing.FindLogCode('ALQ', b) then ShowOnTarget(b); end. ``` ```{figure} ../../images/fairyring_findlog.png ``` - - - ### FairyRing.ClickLogCode ```pascal function TFairyRing.ClickLogCode(fairyCode: String): Boolean; ``` Finds and clicks the `fairyCode` specified in the travel log. Codes casing is ignored. Example: ```pascal WriteLn FairyRing.ClickLogCode('cip'); ``` - - - ## FairyRing.HandleInterface ```pascal function TFairyRing.HandleInterface(code: String): Boolean; ``` Completely handles the fairy ring interface to set a code and teleport. Will use both the log and the dials depending on the user biohash. Example: ```pascal WriteLn FairyRing.HandleInterface('cip'); ``` - - - ## FairyRing.Teleport ```pascal function TFairyRing.Teleport(fairyCode: String; obj: TObject; walk: Boolean = True): Boolean; function TFairyRing.Teleport(fairyCode: String; walk: Boolean = True): Boolean; overload; ``` Teleports the user to the specified fairy ring code. If the fairy ring interface is not open, the `RSObject` will be used to find the closest one and open it. If the code is on the right click context menu, it will be used. You can also optional pass in "Zanaris" or "BKS" to go to zanaris. Example: ```pascal WriteLn FairyRing.Teleport('cip'); ``` - - - ## FairyRing variable Global {ref}`TFairyRing` variable.