Trade Screen

The tradescreen file holds functions and procedures that are used to interact with the runescape Trade interface.

The source for this file can be found here.

Consts, Types, Vars

The following constants, types and variables are used throughout the TradeScreen methods.

type TRSTradeScreen

type
  TRSTradeScreen = type TRSInterface;

A type that stores the Trade Screen interface properties.

var tradeScreen

var
  tradeScreen: TRStradeScreen;

A variable through which scripters can access the TRStradeScreen type methods.

TRStradeScreen methods

The following methods should be called through the tradeScreen variable.

Example:

if tradeScreen.isOpen() then
  writeln('tradeScreen screen is open!');

isOpen

function TRSTradeScreen.isOpen(waitTime: integer = 0; confirm: boolean = false; adaptiveWait: boolean = false): boolean;

Returns true if the tradeScreen is open. The optional waitTime parameter (default = 0) is the maximum time (in milliseconds) it will keep looking. The optional confirm parameter (default = false) will make the script look for the confirm screen if set to true. The function will set the bounds of the interface according to the confirm parameter. If the boolean adaptiveWait is set to true the loop time will be adapted to the waitTime.

Note

  • by Thomas
  • Last Updated: 18 May 2016 by Thomas

Example:

if tradeScreen.isOpen() then
  writeln('It''s open!');

clickButton

procedure TRSTradeScreen.clickButton(button: integer);

Will click the trade button button. Valid button constants are located at the top of this page. If moveMouseAfter is set to true it will move the mouse over the chatBox, this is to prevent highlighting of buttons or items to interfere with the script.

Note

  • by Thomas
  • Last Updated: 18 May 2016 by Thomas

Example:

tradeScreen.clickButton(BANK_BUTTON_ACCEPT);

close

function TRSTradeScreen.close(waitTime: integer = 0; escape: boolean = true; adaptiveWait: boolean = false): boolean;

Returns true if the TradeScreen is successfully closed. It uses the ESC key once by default, but the escape parameter can be set to false to close with mouse. If the boolean adaptiveWait is set to true the loop time will be adapted to the waitTime parameter.

Note

  • by Thomas
  • Last Updated: 18 May 2016 by Thomas

Example:

if tradeScreen.close() then
  writeln('Closed the tradeScreen');

addCoins

procedure TRSTradeScreen.addCoins(amount: integer);

Will add a certain amount of coins using the BANK_BUTTON_COINS.

Note

  • by Thomas
  • Last Updated: 8 December 2015 by Thomas

Example:

tradeScreen.addCoins(1000);

getValue

function TRSTradeScreen.getValue(yours: boolean): integer;

Returns the value of the items offered in the tradeScreen. If the ‘yours’ parameter is set to true, it will return the value of your offer, else it will return the other players offer value.

Note

  • by Thomas
  • Last Updated: 18 May 2016 by Thomas

Example:

if tradeScreen.getValue(true) > 1000 then
  tradeScreen.clickButton(TRADE_BUTTON_ACCEPT);

getOfferSlotBoxes

function TRSTradeScreen.getOfferSlotBoxes(yours: boolean): TBoxArray;

Returns the Offer Slots in the tradeScreen as a TBoxArray. If the ‘yours’ parameter is set to true, it will return the TBoxArray of your side, else it will return the TBoxArray from the other players side. Perhaps more suited as an internal function though.

Note

  • by Thomas
  • Last Updated: 18 May 2016 by Thomas

Example:

if tradeScreen.getValue(true) > 1000 then
  tradeScreen.clickButton(TRADE_BUTTON_ACCEPT);

TRSTradeScreen.countDTM

function TRSTradeScreen.countDTM(dtm: integer; yours: boolean): integer;

Returns the number of DTMs offered in the tradeScreen. If the ‘yours’ parameter is set to true, it will return your offer count, else it will return the other players offer count.

Note

  • by Thomas
  • Last Updated: 8 December 2015 by Thomas

Example:

writeLn(tradeScreen.countDTM(foodDTM, true));

TRSTradeScreen.offerCount

function TRSTradeScreen.offerCount(yours: boolean): integer;

Returns the number of items offered in the tradeScreen. If the ‘yours’ parameter is set to true, it will return your offer count, else it will return the other players offer count.

Note

  • by Thomas
  • Last Updated: 8 December 2015 by Thomas

Example:

writeLn(tradeScreen.offerCount(true));

waitDTMCount

function TRSTradeScreen.waitDTMCount(itemDTM, waitTime, count: integer; yours: boolean = true): boolean;

Will count the itemDTM in either side of the tradeScreen untill a certain count is reached, or untill the waitTime has passed. If yours is set to true (default = true) it will check your side, else it will count the DTM on their part.

Note

  • by Thomas
  • Last Updated: 8 December 2015 by Thomas

Example:

if (not tradeScreen.waitDTMCount(foodDTM, 3000, 28, true)) then
  tradeScreen.clickButton(TRADE_BUTTON_ITEMS);