Chat

Methods to interact with the chat box.


Chat.Setup

procedure TRSChat.Setup; override;

Initializes Chat variables.

Note

This is automatically called on the Chat variable.


Chat.SetupAlignment

procedure TRSChat.SetupAlignment(Mode: ERSClientMode); override;

Setups up the interface aligment for the current client mode.

Note

This is automatically called on the TRSClient.ClientModeChanged function.


Chat.GetLineBoxes

function TRSChat.GetLineBoxes: TBoxArray;

Internal function that returns the bounds of the chat lines.


Chat.GetDisplayNameBox

function TRSChat.GetDisplayNameBox(Colors: TIntegerArray = [$FFFFFF, $000000]): TBox; function TRSChat.GetDisplayNameBox(Colors: TIntegerArray = [$FFFFFF, $000000]): TBox; overload;

Get the user name box. Useful for certain things like hiding the username for screenshots.

Example::

Debug(Chat.GetDisplayNameBox());


Chat.GetDisplayName

function TRSChat.GetDisplayName(Colors: TIntegerArray = [$FFFFFF, $000000]): String;

Get the user displayed name.

Example:

WriteLn('The user name is: ', Chat.GetDisplayName);

Chat.IsTransparent

function TRSChat.IsTransparent: Boolean;

Returns true if the chat box is in transparent mode.

Example:

WriteLn Chat.IsTransparent;

Chat.IsOpen

function TRSChat.IsOpen: Boolean;

Returns true if the chat box is open.

Example:

WriteLn Chat.IsOpen;

Chat.GetQuery

function TRSChat.GetQuery: String;

Returns the query question.

Example:

WriteLn Chat.GetQuery;

Chat.GetQueryAnswer

function TRSChat.GetQueryAnswer: String;

Returns the currently typed answer.

Example:

WriteLn Chat.GetQueryAnswer;

Chat.FindQuery

function TRSChat.FindQuery(Query: String; WaitTime: Int32; Interval: Int32 = -1): Boolean;

Returns true if the specified Query is currently open or opens up within WaitTime.

Example:

WriteLn Chat.FindQuery('How many doses', 2000); //Example query of NMZ Potion Barrels.

Chat.AnswerQuery

function TRSChat.AnswerQuery(Query, Answer: String; WaitTime: Int32; Interval: Int32 = -1): Boolean;

Replies with Answer to the specified Query.

Example:

Chat.AnswerQuery('How many doses', '20', 2000); //Example query of NMZ Potion Barrels.

Chat.GetOptions

function TRSChat.GetOptions(Colors: TIntegerArray = [CHAT_COLOR_BLACK, CHAT_COLOR_WHITE]): TRSChatboxOptionArray;

Internal function to retrieve the currently available chat options.


Chat.FindOption

function TRSChat.FindOption(Text: String; Colors: TIntegerArray = [CHAT_COLOR_WHITE, CHAT_COLOR_BLUE]): Boolean;

Returns true if the specified Text is an available option.

Example:

Chat.FindOption('Yes'); //Common chat option in several instances as an example where you are asked Yes or No.

Chat.ClickOption

function TRSChat.ClickOption(Text: String; UseKeyboard: Boolean = True; Colors: TIntegerArray = [CHAT_COLOR_BLACK, CHAT_COLOR_WHITE]): Boolean;

Attempts to click the specied chat option. If UseKeyboard is true, the keyboard will be used.

Example:

Chat.ClickOption('Yes', True); //Common chat option in several instances as an example where you are asked Yes or No.

Chat.ClickContinue

function TRSChat.ClickContinue(UseKeyboard: Boolean = True): Boolean;

Attempts to click the continue chat option. If UseKeyboard is true, the keyboard will be used.

Example:

Chat.ClickContinue(True);

Chat.ChatToOption

function TRSChat.ChatToOption(Option: String): Boolean;

Continuously advances the chat with TRSChat.ClickContinue until the specified Option appears.

Example:

Chat.ChatToOption('Yes');

Chat.GetMessage

function TRSChat.GetMessage(Line: Int32; Colors: TIntegerArray = CHAT_MESSAGE_COLORS): String;

Get the message in the specified Line.

Example:

WriteLn Chat.GetMessage(5);

Chat.FindMessage

function TRSChat.FindMessage(Message: String; Colors: TIntegerArray = CHAT_MESSAGE_COLORS): Boolean;

Returns true if Message is found in any chat line.

Example:

WriteLn Chat.FindMessage('Buying gf');

Chat.GetChat

function TRSChat.GetChat: String;

Returns the message displayed in a chat when we are talking with an NPC or interacting with something.

Example:

WriteLn Chat.GetChat;

Chat.GetChatTitle

function TRSChat.GetChatTitle: String;

Returns the chat title if available. This is usually a red text and sometimes has 2 swords pointing to it.

Example:

if 'Select an Option' = Chat.GetChatTitle then
  Chat.ClickOption('access my bank');

Chat.LeveledUp

function TRSChat.LeveledUp(): Boolean;

Returns true if we have the level up message on the chat box. Declared here and overriden in stats.simba

Example:

if Chat.LeveledUp then
  Chat.ClickContinue(True);

var Chat

Global Chat variable.