GrandExchange

Methods to interact with the GrandExchange interface:

_images/ge_interface.png

EGEOfferProgress

EGEOfferProgress = enum(NONE, PROGRESSING, COMPLETED, ABORTED);

Enum to represent the Grand Exchange offer slot states.


EGESlotType

EGESlotType = enum(EMPTY, SELL, BUY);

Enum to represent the type of Grand Exchange offer slot.


TRSGrandExchangeSlot

Record that represents a slot in the GrandExchange interface.

When you want to interact with a Grand Exchange slot you should do it through the TRSGrandExchange.Slots array, which is an array of this type.

The next examples will be showing how this is done with random slot numbers.

If you want to visualize what the TRSGrandExchangeSlot has to offer are you can use this short script:

{$I WaspLib/osrs.simba}
var
  img: TImage;
  slot: TRSGrandExchangeSlot;
begin
  img := Target.GetImage();
  for slot in GrandExchange.Slots do
  begin
    case slot.GetType() of
      EGESlotType.EMPTY:
      begin
        img.DrawColor := $00FFFF;
        img.DrawBox(slot.Bounds);
        img.DrawColor := $0000FF;
        img.DrawBox(slot.Header);
        img.DrawColor := $FF00FF;
        img.DrawBox(slot.BuyButton);
        img.DrawColor := $FFFF00;
        img.DrawBox(slot.SellButton);
      end;

      EGESlotType.SELL, EGESlotType.BUY:
      begin
        img.DrawColor := $00FFFF;
        img.DrawBox(slot.Bounds);
        img.DrawColor := $0000FF;
        img.DrawBox(slot.Header);
        img.DrawColor := $FF00FF;
        img.DrawBox(slot.ItemBox);
        img.DrawColor := $FFFF00;
        img.DrawBox(slot.ItemNameBox);
        img.DrawColor := $FFFFFF;
        img.DrawBox(slot.StatusBox);
        img.DrawColor := $0000FF;
        img.DrawBox(slot.ValueBox);
      end;
    end;
  end;

  img.Show();
end.
_images/ge_slots.png

TRSGrandExchangeSlot

function TRSGrandExchangeSlot.GetType(): EGESlotType;

Returns the EGESlotType of the slot. This also sets the TRSGrandExchangeSlot.Typ to the result in case you want to access it later without calling this.

WaspLib will also try to keep TRSGrandExchangeSlot.Typ updated when you interact with the GrandExchange but it cannot track things a user might do manually.

Example:

WriteLn GrandExchange.Slots[2].GetType();

TRSGrandExchangeSlot.Contains

function TRSGrandExchangeSlot.Contains(item: TRSItem): Boolean;

Returns the TRSItem of the slot.

If the slot is empty an empty string is returned.

Example:

WriteLn GrandExchange.Slots[0].Contains('Abyssal whip');

TRSGrandExchangeSlot.Discover

function TRSGrandExchangeSlot.Discover(): TRSItemArray;

Uses item discover to return a TRSItemArray of the possible items in the slot.

If the slot is empty an empty array is returned.

Example:

WriteLn GrandExchange.Slots[5].Discover();

TRSGrandExchangeSlot.ReadItem

function TRSGrandExchangeSlot.ReadItem(): TRSItem;

Reads the item text in the offer slot.

Example:

WriteLn GrandExchange.Slots[7].ReadItem();

TRSGrandExchangeSlot.Value

function TRSGrandExchangeSlot.Value(): Integer;

Reads the value text in the offer slot and returns it as an Integer.

Example:

WriteLn GrandExchange.Slots[3].Value();

TRSGrandExchangeSlot.GetProgress

function TRSGrandExchangeSlot.GetProgress(): EGEOfferProgress;

Returns the slot EGEOfferProgress.

Example:

WriteLn GrandExchange.Slots[2].GetProgress();

TRSGrandExchange

Record responsible to handle the GrandExchange interface.


GrandExchange.SetupInterface

procedure TRSGrandExchange.SetupInterface();

Internal method used to setup the TRSGrandExchange coordinates. This is automatically called for you on the GrandExchange variable.


GrandExchange.IsOpen

function TRSGrandExchange.IsOpen(): Boolean;

Returns true if the Grand Exchange is open.

Example:

WriteLn GrandExchange.IsOpen();

GrandExchange.WaitOpen

function TRSGrandExchange.WaitOpen(time: Integer; interval: Integer = -1): Boolean;

Returns true if the Grand Exchange is open within time milliseconds.

Example:

WriteLn GrandExchange.WaitOpen();

GrandExchange.Close

function TRSGrandExchange.Close(escape: Boolean): Boolean;
function TRSGrandExchange.Close(escapeProbability: Single = 0): Boolean; overload;

Closes the GrandExchange, Depending on escape or `escapeProbability the function will either click the button or press escape key.

Example:

 WriteLn GrandExchange.Close();

GrandExchange variable

Global TRSGrandExchange variable.