Chat Box

The chatbox file holds functions and procedures that are used in the runescape chat box.

The source for this file can be found here.

Consts, Types, Vars

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

const Tesseract Fiter

const
  TESS_FILTER_CHATBOX: TTesseractFilter = [3, 3, [False, 35, TM_Mean]];

The TTesseractFilter that is used by the chatBox text functions by default. Scripters can create and use their own filters if they wish.

type TRSChatBox

type
  TRSChatBox = type TRSInterface;

A type that stores the chatBox interface properties.

var chatBox

var
  chatBox: TRSChatBox;

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

TRSChatBox methods

The following methods should be called through the chatBox variable.

Example:

if chatBox.findText(['Hello']) then
  writeln('We found Hello in the chatBox');

getChatArea

function TRSChatBox.getChatArea(): TBox;

Returns a TBox of the area where the chat text is located.

Note

  • by Olly
  • Last Updated: 17 October 2013 by Olly

Example:

var
  area: TBox;
begin
  area := chatBox.getChatArea();
end;

findText

function TRSChatBox.findText(txt: TStringArray; const Filter: TTesseractFilter = TESS_FILTER_CHATBOX): boolean;

Returns true if any of the text in txt is found anywhere in the chat box. The scripter has the option of using a custom TTesseractFilter Filter .

Note

  • by Olly
  • Last Updated: 17 October 2013 by Olly

Example:

if chatBox.findAnyText(['Hello']) then
  writeLn('We found Hello in the chatBox');

getTextOnLine

function TRSChatBox.getTextOnLine(Line: Integer; Filter: TTesseractFilter = TESS_FILTER_CHATBOX): String;

Returns the string of text on chatBox line Line . The scripter has the option of using a custom TTesseractFilter Filter . The bottom line in the chatBox is line 0.

Note

  • by Olly
  • Last Updated: 17 October 2013 by Olly

Example:

writeLn(chatBox.getTextOnLine(0));

findTextOnLines

function TRSChatBox.findTextOnLines(txt: TStringArray; lines: TIntegerArray; Filter: TTesseractFilter = TESS_FILTER_CHATBOX): boolean;

Returns true if any of the text in txt is found on any of the chatBox lines lines .The scripter has the option of using a custom TTesseractFilter Filter . The bottom line in the chatBox is line 0.

Note

  • by Olly
  • Last Updated: 17 October 2013 by Olly

Example:

// returns true if "Hello" or "Hi" is found on the first 4 lines
chatBox.findTextOnLines(['Hello', 'Hi'], [0..3]);

getXPBar

function TRSChatBox.getXPBar(): Integer;

Returns the XP from the XP bar when it is placed in the top right corner of the chatBox.

Note

  • by Ashaman88
  • Last Updated: Some time in 2014 by Olly

Example:

var
  xpGain: Integer;
begin
  xpGain := chatBox.getXPBar() - StartXP;
end;

enterAmount

function TRSChatBox.enterAmount(amount, waitTime: integer): boolean;

Returns true if it enters the amount amount in the chatBox popup. It will keep trying until successful of waitTime is reached.

Note

  • by Thomas
  • Last Updated: 11 December by Thomas

Example:

chatBox.enterAmount(50, 5000);

findTextBoxes

function TRSChatBox.findTextBoxes(search: integer): TBoxArray;

Returns the TBoxArray of the type/color of text it searches for. Usefull for accepting trades or adding certain players to ignore. They are sorted from top to bottom (old to new). The possible types of text to search for can be found at the top of the chatbox.simba file.

Note

  • by Thomas
  • Last Updated: 11 December by Thomas

Example:

trades := chatBox.findTextBoxes(CHATBOX_TRADES);
if length(trades) then
  mouseBox(trades[high(trades)], MOUSE_RIGHT);