# Chat Methods to interact with the chat box. - - - ## Chat.Setup ```pascal procedure TRSChat.Setup; override; ``` Initializes **Chat** variables. ```{note} This is automatically called on the **Chat** variable. ``` - - - ## Chat.SetupAlignment ```pascal 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 ```pascal 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 ```pascal function TRSChat.GetDisplayName(Colors: TIntegerArray = [$FFFFFF, $000000]): String; ``` Get the user displayed name. Example: ```pascal WriteLn('The user name is: ', Chat.GetDisplayName); ``` - - - ## Chat.IsTransparent ```pascal function TRSChat.IsTransparent: Boolean; ``` Returns true if the chat box is in transparent mode. Example: ```pascal WriteLn Chat.IsTransparent; ``` - - - ## Chat.IsOpen ```pascal function TRSChat.IsOpen: Boolean; ``` Returns true if the chat box is open. Example: ```pascal WriteLn Chat.IsOpen; ``` - - - ## Chat.GetQuery ```pascal function TRSChat.GetQuery: String; ``` Returns the query question. Example: ```pascal WriteLn Chat.GetQuery; ``` - - - ## Chat.GetQueryAnswer ```pascal function TRSChat.GetQueryAnswer: String; ``` Returns the currently typed answer. Example: ```pascal WriteLn Chat.GetQueryAnswer; ``` - - - ## Chat.FindQuery ```pascal 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: ```pascal WriteLn Chat.FindQuery('How many doses', 2000); //Example query of NMZ Potion Barrels. ``` - - - ## Chat.AnswerQuery ```pascal function TRSChat.AnswerQuery(Query, Answer: String; WaitTime: Int32; Interval: Int32 = -1): Boolean; ``` Replies with **Answer** to the specified **Query**. Example: ```pascal Chat.AnswerQuery('How many doses', '20', 2000); //Example query of NMZ Potion Barrels. ``` - - - ## Chat.GetOptions ```pascal function TRSChat.GetOptions(Colors: TIntegerArray = [CHAT_COLOR_BLACK, CHAT_COLOR_WHITE]): TRSChatboxOptionArray; ``` Internal function to retrieve the currently available chat options. - - - ## Chat.FindOption ```pascal 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: ```pascal Chat.FindOption('Yes'); //Common chat option in several instances as an example where you are asked Yes or No. ``` - - - ## Chat.ClickOption ```pascal 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: ```pascal Chat.ClickOption('Yes', True); //Common chat option in several instances as an example where you are asked Yes or No. ``` - - - ## Chat.ClickContinue ```pascal function TRSChat.ClickContinue(UseKeyboard: Boolean = True): Boolean; ``` Attempts to click the continue chat option. If **UseKeyboard** is true, the keyboard will be used. Example: ```pascal Chat.ClickContinue(True); ``` - - - ## Chat.ChatToOption ```pascal function TRSChat.ChatToOption(Option: String): Boolean; ``` Continuously advances the chat with **TRSChat.ClickContinue** until the specified **Option** appears. Example: ```pascal Chat.ChatToOption('Yes'); ``` - - - ## Chat.GetMessage ```pascal function TRSChat.GetMessage(Line: Int32; Colors: TIntegerArray = CHAT_MESSAGE_COLORS): String; ``` Get the message in the specified **Line**. Example: ```pascal WriteLn Chat.GetMessage(5); ``` - - - ## Chat.FindMessage ```pascal function TRSChat.FindMessage(Message: String; Colors: TIntegerArray = CHAT_MESSAGE_COLORS): Boolean; ``` Returns true if **Message** is found in any chat line. Example: ```pascal WriteLn Chat.FindMessage('Buying gf'); ``` - - - ## Chat.GetChat ```pascal function TRSChat.GetChat: String; ``` Returns the message displayed in a chat when we are talking with an NPC or interacting with something. Example: ```pascal WriteLn Chat.GetChat; ``` - - - ## Chat.GetChatTitle ```pascal 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: ```pascal if 'Select an Option' = Chat.GetChatTitle then Chat.ClickOption('access my bank'); ``` - - - ## Chat.LeveledUp ```pascal 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: ```pascal if Chat.LeveledUp then Chat.ClickContinue(True); ``` - - - ## var Chat Global Chat variable.