# Chat Options The {ref}`Chat` interface options menu that shows up when you are interacting with certain objects or NPCs. ```{figure} ../../images/chat_options.png A chat options menu. ``` - - - ## TRSChatOption Helper record to handler chat options. - - - ## Chat.GetOptions ```pascal function TRSChat.GetOptions(colors: TIntegerArray = []): TRSChatOptionArray; function TRSChat.GetOptions(): String; overload; ``` Returns every chat option visible with the specified `colors`. Example: ```pascal img := Target.GetImage(); for option in Chat.GetOptions() do img.DrawBox(option.Bounds); img.Show(); img.Free(); ``` ```{figure} ../../images/chat_getoptions.png Highlighting Chat.GetOptions() ``` - - - ## Chat.GetOptionsString ```pascal function TRSChat.GetOptionsString(): String; ``` Returns every chat option visible in black and white as a string. Example: ```pascal WriteLn Chat.GetOptionsString(); ``` - - - ## Chat.FindOption ```pascal 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 {ref}`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: ```pascal option := Chat.FindOption('access my bank'); ShowOnTarget(option.Bounds); ``` ```{figure} ../../images/chat_findoption.png Highlighting Chat.FindOption() ``` - - - ## Chat.HasOption ```pascal 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: ```pascal WriteLn Chat.HasOption('access my bank'); ``` - - - ## Chat.WaitOption ```pascal function TRSChat.WaitOption(chatOption: String; caseSensitive: Boolean = True; colors: TIntegerArray = []; time: Integer = 600; interval: Integer = -1): Boolean; ``` Same as {ref}`Chat.HasOption` but waits up to `time` milliseconds for it to be true. Example: ```pascal WriteLn Chat.WaitOption('access my bank'); ``` - - - ## Chat.Select ```pascal function TRSChat.Select(chatOption: String; caseSensitive: Boolean = True; keyboardProbability: Single = -1; colors: TIntegerArray = []): Boolean; ``` Selects a chat option whose text matches `chatOption`. Example: ```pascal WriteLn Chat.Select('access my bank'); ``` - - - ## Chat.ContinueChat ```pascal function TRSChat.ContinueChat(keyboardProbability: Single = -1): Boolean; ``` Selects the "Click here to continue" chat option. Example: ```pascal WriteLn Chat.ContinueChat(); ``` - - - ## Chat.ContinueUntilOption ```pascal 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: ```pascal WriteLn Chat.ContinueUntilOption('access my bank'); ``` - - - ## Chat.GetTitle ```pascal 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: ```pascal WriteLn Chat.GetTitle(); ``` - - - ## Chat.IsTitle ```pascal function TRSChat.IsTitle(text: String; similarity: Single = 0.8): Boolean; ``` Returns True/False if the current chat title matches `text`. Example: ```pascal WriteLn Chat.IsTitle('Select an option'); ``` - - - ## Chat.IsTitle ```pascal function TRSChat.IsTitle(text: String; similarity: Single = 0.8): Boolean; ``` Returns True/False if the current chat title matches `text`. Example: ```pascal WriteLn Chat.IsTitle('Select an option'); ``` - - - ## Chat.LeveledUp ```pascal function TRSChat.LeveledUp(): Boolean; ``` Returns true if we have the level up message on the chat box. This function is overriden in {ref}`Chat.LevelUp override` to increment {ref}`Stats` `Levels` variables. Example: ```pascal if Chat.LeveledUp() then Chat.Continue(); ``` - - - ## Chat.HandleLevelUp ```pascal function TRSChat.HandleLevelUp(keyboardProbability: Single = -1): Boolean; ``` Attempts to handle the {ref}`Chat.LevelUp` notification. Example: ```pascal Chat.HandleLevelUp(); ```