Chat¶
The 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 Make menu.
EChatColor enum¶
EChatColor = enum(BLACK, MAROON .. NAVY, GREEN);
Enum representing each of the available chat text colors.
EIron enum¶
EIron = enum(
NONE, IRONMAN, HARDCORE, ULTIMATE, GROUP, HARCORE_GROUP, UNRANKED_GROUP
);
Enum representing each of the available ironman types.
TChat¶
Main record used to interact with the Chat interface.
Chat.SetupInterface¶
procedure TChat.SetupInterface();
Internal method used to setup the TChat coordinates. This is automatically called for you on the Chat variable.
Chat.Tabs variable¶
Tabs: TChatTabs;
For more information on chat tabs read ChatTabs.
You can access the TChat ChatTabs through the Tabs variable:
ShowOnTarget(Chat.Tabs.Bounds);
Chat.GetColors¶
function TChat.GetColors(colors: EChatColorArray): TColorArray;
Convenience method used to conver the human readable colors in a
EChatColorArray format into a TColorArray which has the colors in BGR
format.
Example:
WriteLn Chat.GetColors([EChatColor.RED, EChatColor.WHITE]);
Chat.GetDisplayNameBox¶
function TChat.GetDisplayNameBox(out color: Integer): TBox;
function TChat.GetDisplayNameBox(): TBox; overload;
Returns the bounds of the display name on the Chat box.
You can optionally get the display name color back through the color variable.
Example:
ShowOnTarget(Chat.GetDisplayNameBox());
Chat.GetDisplayName¶
function TChat.GetDisplayName(): String;
Returns the account display name on the Chat box as a string.
Example:
WriteLn Chat.GetDisplayName();
Chat.GetIronManType¶
function TChat.GetIronManType() : EIron;
Returns the account ironman type.
Example:
WriteLn Chat.GetIronManType();
Chat.IsTransparent¶
function TChat.IsTransparent(): Boolean;
Returns true if the Chat box is in transparent mode.
Example:
WriteLn Chat.IsTransparent();
Chat.IsOpen¶
function TChat.IsOpen(): Boolean;
Returns True/False if the Chat is open.
Example:
if Chat.IsOpen() then
ShowOnTarget(Chat.Bounds);
Chat.Close¶
function TChat.Close(): Boolean;
Attempts to close the Chatinterface.
Example:
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:
A chat query.¶
Chat.GetQuery¶
function TChat.GetQuery(): String;
Returns the query shown on the Chat interface if any as a string.
Example:
WriteLn Chat.Close();
Chat.GetQueryAnswer¶
function TChat.GetQueryAnswer(): String;
Returns the query current answer to the query in the Chat interface if any.
Example:
WriteLn Chat.GetQueryAnswer();
Chat.FindQuery¶
function TChat.FindQuery(const query: String; matchCase: Boolean = False): Boolean;
Returns the True/False if the Chat interface currently has the specified
query visible.
Example:
WriteLn Chat.FindQuery('Enter amount');
Chat.WaitQuery¶
function TChat.WaitQuery(
const query: String;
matchCase: Boolean;
time: Integer = TICK;
interval: Integer = -1
): Boolean;
Returns the true if the specified query is visible in the Chat
interface within time milliseconds.
Example:
WriteLn Chat.WaitQuery('Enter amount');
Chat.AnswerQuery¶
function TChat.AnswerQuery(
query, answer: String; waitTime: Integer = TICK; interval: Integer = -1
): Boolean;
Attempts to reply to the specified query with answer if it’s available in the
Chat interface within waitTime milliseconds.
Example:
WriteLn Chat.AnswerQuery('Enter amount', '15');
Chat.GetMessage¶
function TChat.GetMessage(line: Integer): String;
Get the message in the specified line.
For consistency reasons all the symbols are stripped from the result.
Example:
WriteLn Chat.GetMessage(5);
Credits: Original design inspired on Olly’s solution for this on his 2.0 library.
Chat.IndexOfMessage¶
function TChat.IndexOfMessage(const msg: String; matchCase: Boolean = False): Integer;
Find which line has a specific msg either entirely or partially if any.
Example:
WriteLn Chat.IndexOfMessage('Hello world');
Chat.ContainsMessage¶
function TChat.ContainsMessage(const msg: String; matchCase: Boolean = False): Boolean;
Returns True/False if the specified msg is visible on the Chat interface.
Example:
WriteLn Chat.ContainsMessage('Hello world');
Chat.CountNewMessage¶
function TChat.CountNewMessage(const msg: String; matchCase: Boolean = False): Integer;
Counts how many time the specified msg repeats without any other message in
between from the most recent one.
This can be useful to know if you performed a task sometimes, for example, knowing if you tried to light a fire on top of another:
{$I WaspLib/main.simba}
var
oldCount, newCount: Integer;
begin
oldCount := Chat.CountNewMessage('You can''t light a fire here.');
Inventory.Combine('Tinderbox', 'Logs');
Sleep(8*TICK);
newCount := Chat.CountNewMessage('You can''t light a fire here.');
if newCount > oldCount then
WriteLn('Tried to light a fire and failed.');
end.
Chat.GetMessagesString¶
function TChat.GetMessagesString(): String;
Returns every chat message visible as a string.
Example:
WriteLn Chat.GetMessagesString();
Chat.InputHasText¶
function TChat.InputHasText(): Boolean;
Returns True/False if input line has text written that was never sent.
Example:
WriteLn Chat.InputHasText();
Chat variable¶
Global TChat variable.