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.


TChatOption

Helper record to handler chat options.


Chat.Options property

property TChat.Options(const colors: TColorArray): TChatOptionArray;
property TChat.Options: TChatOptionArray;

Returns every chat option visible with the specified colors.

Example:

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

Chat.Options.ToString

function TChatOptionArray.ToString(): String;

Returns the TChatOptionArray as a string with it’s options separated with LINE_SEP.

Example:

WriteLn Chat.Options.ToString();

Chat.Options.IndexOf

function TChatOptionArray.IndexOf(const txt: String; matchCase: Boolean = True): Integer;

Returns the index of the specified option.

option doesn’t have to be the entire string of the option, a partial string is fine.

Example:

{$I WaspLib/main.simba}
var
  options: TChatOptionArray;
  i: Integer;
begin
  options := Chat.Options;
  i := options.IndexOf('access my bank');
  if i >= 0 then
    ShowOnTarget(options[i].Bounds);
end.
../../images/chat_findoption.png

Chat.Options.Get

function TChatOptionArray.Get(
  const txt: String; matchCase: Boolean = True
): TChatOption;

Returns the specified txt as a TChatOption if it exists on the current TChatOptionArray.

txt doesn’t have to be the entire string of the option, a partial string is fine.

Example:

{$I WaspLib/main.simba}
begin
  ShowOnTarget(Chat.Options.Get('access my bank').Bounds);
end.
../../images/chat_findoption.png

Chat.Options.Contains

function TChatOptionArray.Contains(
  const txt: String; matchCase: Boolean = True
): Boolean; overload;

Returns True/False if the chat option with the specified txt text is in this TChatOptionArray.

txt doesn’t have to be the entire string of the option, a partial string is fine.

Example:

WriteLn Chat.Options.Contains('access my bank');

Chat.Options.Select

function TChatOptionArray.Select(
  const txt: String; matchCase: Boolean = True; keyProbability: Single = -1
): Boolean;

Selects a chat option whose text matches txt.

Example:

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

Chat.WaitOption

function TChat.WaitOption(
  const txt: String;
  matchCase: Boolean = True;
  colors: TColorArray = CHAT_OPTION_COLORS;
  time: Integer = TICK;
  interval: Integer = -1
): Boolean;

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

Example:

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

Chat Options: Continue

Methods to handle the continue option in the Chat box.


Chat.ContainsContinue

function TChat.ContainsContinue(): Boolean;

Returns true if there’s a “Click here to continue” option available.

Example:

WriteLn Chat.ContainsContinue();

Chat.ContinueChat

function TChat.ContinueChat(keyProbability: Single = -1): Boolean;

Selects the “Click here to continue” chat option.

Example:

WriteLn Chat.ContinueChat();

Chat.ContinueUntilOption

function TChat.ContinueUntilOption(const txt: String; timeout: Int64 = 10*SECOND): 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 Options: Title

Methods and properties to handle the title option in the Chat box. The “Title” option is a text you cannot select and is red, often with 2 swords pointing to it but not always.


Chat.Title

property TChat.Title: String;

Returns the chat options title.

Example:

WriteLn Chat.Title;

Chat.IsTitle

function TChat.IsTitle(const txt: String; similarity: Single = 0.8): Boolean;

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

Example:

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

Chat.WaitTitle

function TChat.WaitTitle(
  const txt: String;
  time: Integer = TICK;
  similarity: Single = 0.8;
  interval: Integer = -1
): Boolean;

Returns True/False if the current chat title matches txt until time runs out.

Example:

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

Chat Options: Level Up

Methods to handle level up messages.


Chat.LeveledUp

function TChat.LeveledUp(): Boolean;

Returns true if we have the level up message on the chat box.

Example:

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

Chat.HandleLevelUp

function TChat.HandleLevelUp(keyProbability: Single = -1): Boolean;

Attempts to handle the Chat.LevelUp notification.

Example:

Chat.HandleLevelUp();