# Chat The {ref}`Chat` interface is the interface that shows up at the bottom left corner of the game client where you can communicate with other players, receive game messages and even interact with some options and menus it hosts like the {ref}`Make` menu. ```{figure} ../../images/chat_interface.png ``` - - - ## ERSChatColor ```pascal ERSChatColor = enum( BLACK, MAROON, BLUE, PURPLE, RED, LIGHT_RED, WHITE, LIGHT_PURPLE, NAVY, GREEN ); ``` Enum representing each of the available chat text colors. - - - ## ERSIronMan ```pascal ERSIronMan = enum(NONE, IRONMAN, HARDCORE, ULTIMATE, GROUP, HARCORE_GROUP, UNRANKED_GROUP); ``` Enum representing each of the available ironman types. - - - ## TRSChat Main record used to interact with the {ref}`Chat` interface. - - - ## Chat.SetupInterface ```pascal procedure TRSChat.SetupInterface(); ``` Internal method used to setup the {ref}`TRSChat` coordinates. This is automatically called for you on the {ref}`Chat variable`. - - - ## Chat.Tabs variable ```pascal Tabs: TRSChatTabs; ``` For more information on chat tabs read {ref}`ChatTabs`. You can access the {ref}`TRSChat` {ref}`ChatTabs` through the `Tabs variable`: ```pascal ShowOnTarget(Chat.Tabs.Bounds); ``` ```{figure} ../../images/chattabs_bounds.png ``` - - - ## Chat.GetColors ```pascal function TRSChat.GetColors(colors: ERSChatColorArray): TColorArray; ``` Convenience method used to conver the human readable `colors` in a `ERSChatColorArray` format into a `TColorArray` which has the colors in BGR format. Example: ```pascal WriteLn Chat.GetColors([ERSChatColor.RED, ERSChatColor.WHITE]); ``` - - - ## Chat.GetDisplayNameBox ```pascal function TRSChat.GetDisplayNameBox(out color: Integer): TBox; function TRSChat.GetDisplayNameBox(): TBox; overload; ``` Returns the bounds of the display name on the {ref}`Chat` box. You can optionally get the display name color back through the `color` variable. Example: ```pascal ShowOnTarget(Chat.GetDisplayNameBox()); ``` - - - ## Chat.GetDisplayName ```pascal function TRSChat.GetDisplayName(): String; ``` Returns the account display name on the {ref}`Chat` box as a string. Example: ```pascal WriteLn Chat.GetDisplayName(); ``` - - - ## Chat.GetIronManType ```pascal function TRSChat.GetIronManType() : ERSIronMan; ``` Returns the account ironman type. Example: ```pascal WriteLn Chat.GetIronManType(); ``` - - - ## Chat.IsTransparent ```pascal function TRSChat.IsTransparent(): Boolean; ``` Returns true if the {ref}`Chat` box is in transparent mode. Example: ```pascal WriteLn Chat.IsTransparent(); ``` - - - ## Chat.IsOpen ```pascal function TRSChat.IsOpen(): Boolean; ``` Returns True/False if the {ref}`Chat` is open. Example: ```pascal if Chat.IsOpen() then ShowOnTarget(Chat.Bounds); ``` - - - ## Chat.Close ```pascal function TRSChat.Close(): Boolean; ``` Attempts to close the {ref}`Chat`interface. Example: ```pascal WriteLn Chat.Close(); ``` - - - ## Chat Queries A chat query is when you have some kind of question on the chatbox which you have to reply to. For example, when you try to "withdraw-x" from the bank, you are asked for the quantity: ```{figure} ../../images/chat_query.png A chat query. ``` - - - ### Chat.GetQuery ```pascal function TRSChat.GetQuery(): String; ``` Returns the query shown on the {ref}`Chat` interface if any as a string. Example: ```pascal WriteLn Chat.Close(); ``` - - - ### Chat.GetQueryAnswer ```pascal function TRSChat.GetQueryAnswer(): String; ``` Returns the query current answer to the query in the {ref}`Chat` interface if any. Example: ```pascal WriteLn Chat.GetQueryAnswer(); ``` - - - ### Chat.FindQuery ```pascal function TRSChat.FindQuery(query: String; caseSensitive: Boolean = False): Boolean; ``` Returns the True/False if the {ref}`Chat` interface currently has the specified `query` visible. Example: ```pascal WriteLn Chat.FindQuery('Enter amount'); ``` - - - ### Chat.WaitQuery ```pascal function TRSChat.WaitQuery(query: String; caseSensitive: Boolean = False; time: Integer = 600; interval: Integer = -1): Boolean; ``` Returns the true if the specified `query` is visible in the {ref}`Chat` interface within `time` milliseconds. Example: ```pascal WriteLn Chat.WaitQuery('Enter amount'); ``` - - - ### Chat.AnswerQuery ```pascal function TRSChat.AnswerQuery(query, answer: String; waitTime: Integer = 600; interval: Integer = -1): Boolean; ``` Attempts to reply to the specified `query` with `answer` if it's available in the {ref}`Chat` interface within `waitTime` milliseconds. Example: ```pascal WriteLn Chat.AnswerQuery('Enter amount', '15'); ``` - - - ## Chat.GetMessage ```pascal function TRSChat.GetMessage(line: Integer; colors: TIntegerArray = []): String; ``` Get the message in the specified `line`. Example: ```pascal WriteLn Chat.GetMessage(5); ``` Credits: Heavily based on Olly's solution for this on his 2.0 library. - - - ## Chat.FindMessageLine ```pascal function TRSChat.FindMessageLine(msg: String; caseSensitive: Boolean = False; colors: TIntegerArray = []): Integer; ``` Find which line has a specific `msg` either entirely or partially if any. Example: ```pascal WriteLn Chat.FindMessageLine('Hello world'); ``` - - - ## Chat.ContainsMessage ```pascal function TRSChat.ContainsMessage(msg: String; caseSensitive: Boolean = False; colors: TIntegerArray = []): Boolean; ``` Returns True/False if the specified `msg` is visible on the {ref}`Chat` interface. Example: ```pascal WriteLn Chat.ContainsMessage('Hello world'); ``` - - - ## Chat.InputHasText ```pascal function TRSChat.InputHasText(): Boolean; ``` Returns True/False if input line has text written that was never sent. Example: ```pascal WriteLn Chat.InputHasText(); ``` - - - ## Chat variable Global {ref}`TRSChat` variable.