GrandExchange¶
Methods to interact with the GrandExchange interface:
The GrandExchange is a very complex interface, probably the most complex available in OldSchool RuneScape and for that reason, the functionality to fully interact with it is split into multiple files and records:
GrandExchange, the main grand exchange screen and what this page is about.
GrandExchangeHistory, the history screen of the grand exchange.
GrandExchangeChat, the chat interface of the grand exchange when you are setting up a buy offer.
GrandExchangeOffer, the screen of the grand exchange where you view or setup a new offer.
EGEOfferStatus¶
EGEOfferStatus = 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.
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.Item¶
property TRSGrandExchangeSlot.Item: TRSItem;
Reads the item text in the offer slot.
Example:
WriteLn GrandExchange.Slots[7].Item;
TRSGrandExchangeSlot.Value¶
property TRSGrandExchangeSlot.Value: Integer;
Reads the value text in the offer slot and returns it as an Integer.
Example:
WriteLn GrandExchange.Slots[3].Value;
TRSGrandExchangeSlot.Quantity¶
property TRSGrandExchangeSlot.Quantity: Integer;
Returns the quantity text in the offer slot as an Integer.
Example:
WriteLn GrandExchange.Slots[4].Quantity;
TRSGrandExchangeSlot.TotalValue¶
property TRSGrandExchangeSlot.TotalValue: Integer;
Returns the total value of the offer slot. Taking into account the Grand Exchange tax for sell offers.
Example:
WriteLn GrandExchange.Slots[5].TotalValue;
TRSGrandExchangeSlot.Status¶
property TRSGrandExchangeSlot.Status: EGEOfferStatus;
Returns the slot EGEOfferStatus status.
Example:
WriteLn GrandExchange.Slots[2].Status;
TRSGrandExchangeSlot.Progress¶
property TRSGrandExchangeSlot.Progress: Integer;
Returns the progress percentage of the slot.
Example:
WriteLn GrandExchange.Slots[2].Progress;
TRSGrandExchangeSlot.Open¶
function TRSGrandExchangeSlot.Open(): Boolean;
Attempts to open the GrandExchangeOffer status screen of an existing offer.
Example:
WriteLn GrandExchange.Slots[1].Open();
TRSGrandExchangeSlot.Buy¶
function TRSGrandExchangeSlot.Buy(): Boolean;
Attempts to open the GrandExchangeOffer screen with the buy button.
Example:
WriteLn GrandExchange.Slots[2].Buy();
TRSGrandExchangeSlot.Sell¶
function TRSGrandExchangeSlot.Sell(): Boolean;
Attempts to open the GrandExchangeOffer screen with the sell button.
Example:
WriteLn GrandExchange.Slots[2].Sell();
TRSGrandExchangeSlot.Abort¶
function TRSGrandExchangeSlot.Abort(): Boolean;
Attempts to abort an ongoing offer in the slot.
Example:
WriteLn GrandExchange.Slots[3].Abort();
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.GetEmptySlots¶
function TRSGrandExchange.GetEmptySlots(): TRSGrandExchangeSlotArray;
Returns a TRSGrandExchangeSlotArray of the empty slots available.
Example:
{$I WaspLib/osrs.simba}
var
img: TImage;
slot: TRSGrandExchangeSlot;
begin
img := Target.GetImage();
img.DrawColor := $00FFFF;
for slot in GrandExchange.GetEmptySlots() do
img.DrawBox(slot.Bounds);
img.Show();
end.
GrandExchange.IndexOfEmptySlot¶
function TRSGrandExchange.IndexOfEmptySlot(): Integer;
Returns the index of the first empty slot available.
Example:
WriteLn GrandExchange.IndexOfEmptySlot();
GrandExchange.GetEmptySlot¶
function TRSGrandExchange.GetEmptySlot(): TRSGrandExchangeSlot;
Returns a TRSGrandExchangeSlot that is empty.
Example:
{$I WaspLib/osrs.simba}
begin
ShowOnTarget(GrandExchange.GetEmptySlot().Bounds);
end.
TRSGrandExchange.Collect¶
function TRSGrandExchange.Collect(): Boolean;
Attempts to Collect from the Grand Exchange.
In case of failure, returns False.
Example:
WriteLn GrandExchange.Collect();
GrandExchange variable¶
Global TRSGrandExchange variable.