Chat Options

The Chat interface options menu that shows up when you are interacting with certain objects or NPCs.

_images/chat_options.png

A chat options menu.


TRSChatOption

Helper record to handler chat options.


Chat.GetOptions

function TRSChat.GetOptions(colors: TIntegerArray = []): TRSChatOptionArray;
function TRSChat.GetOptions(): String; overload;

Returns every chat option visible with the specified colors.

Example:

img := Target.GetImage();
for option in Chat.GetOptions() do
  img.DrawBox(option.Bounds);
img.Show();
img.Free();
_images/chat_getoptions.png

Highlighting Chat.GetOptions()


Chat.GetOptionsString

function TRSChat.GetOptionsString(): String;

Returns every chat option visible in black and white as a string.

Example:

WriteLn Chat.GetOptionsString();

Chat.FindOption

function TRSChat.FindOption(chatOption: String; caseSensitive: Boolean = True; colors: TIntegerArray = []): TRSChatOption;

Returns the chat option with the specified chatOption text if it’s visible with the specified colors. The result is returned as a TRSChatOption.

chatOption doesn’t have to be the entire string of the option, partially is fine. If colors is empty like it is by default, $0, $FFFFFF and $FF0000 (black, white and blue) are used.

Example:

option := Chat.FindOption('access my bank');
ShowOnTarget(option.Bounds);
_images/chat_findoption.png

Highlighting Chat.FindOption()


Chat.HasOption

function TRSChat.HasOption(chatOption: String; caseSensitive: Boolean = True; colors: TIntegerArray = []): Boolean;

Returns True/False if the chat option with the specified chatOption text is visible with the specified colors.

chatOption doesn’t have to be the entire string of the option, partially is fine. If colors is empty like it is by default, $0, $FFFFFF and $FF0000 (black, white and blue) are used.

Example:

WriteLn Chat.HasOption('access my bank');

Chat.WaitOption

function TRSChat.WaitOption(chatOption: String; caseSensitive: Boolean = True; colors: TIntegerArray = []; time: Integer = 600; interval: Integer = -1): Boolean;

Same as Chat.HasOption but waits up to time milliseconds for it to be true.

Example:

WriteLn Chat.WaitOption('access my bank');

Chat.Select

function TRSChat.Select(chatOption: String; caseSensitive: Boolean = True; keyboardProbability: Single = -1; colors: TIntegerArray = []): Boolean;

Selects a chat option whose text matches chatOption.

Example:

WriteLn Chat.Select('access my bank');

Chat.ContinueChat

function TRSChat.ContinueChat(keyboardProbability: Single = -1): Boolean;

Selects the “Click here to continue” chat option.

Example:

WriteLn Chat.ContinueChat();

Chat.ContinueUntilOption

function TRSChat.ContinueUntilOption(option: String; timeout: Integer = 10000): Boolean;

Selects the “Click here to continue” continuously until option is available as a chat option or until we reach the timeout which is measured in milliseconds.

Example:

WriteLn Chat.ContinueUntilOption('access my bank');

Chat.GetTitle

function TRSChat.GetTitle(): String;

Returns the title above the chat options, this is a text you cannot select and red, often with 2 swords pointing to it.

Example:

WriteLn Chat.GetTitle();

Chat.IsTitle

function TRSChat.IsTitle(text: String; similarity: Single = 0.8): Boolean;

Returns True/False if the current chat title matches text.

Example:

WriteLn Chat.IsTitle('Select an option');

Chat.IsTitle

function TRSChat.IsTitle(text: String; similarity: Single = 0.8): Boolean;

Returns True/False if the current chat title matches text.

Example:

WriteLn Chat.IsTitle('Select an option');

Chat.LeveledUp

function TRSChat.LeveledUp(): Boolean;

Returns true if we have the level up message on the chat box. This function is overriden in Chat.LevelUp override to increment Stats Levels variables.

Example:

if Chat.LeveledUp() then
  Chat.Continue();

Chat.HandleLevelUp

function TRSChat.HandleLevelUp(keyboardProbability: Single = -1): Boolean;

Attempts to handle the Chat.LevelUp notification.

Example:

Chat.HandleLevelUp();