aran armath
2010-06-04 02:07:37
{*******************************************************************************
function LastChatMessage(ChatType: Integer): string;
By: lordsaturn
Description: Gets last chat message loaded according to 'ChatType'. (see
GetChatMessages for a list of chat types)
*******************************************************************************}
function LastChatMessage(ChatType: Integer): string;
var
S : TStringArray;
begin
S := GetChatMessages(ChatType, False, False);
try
Result := s[0];
except end;
end;Shouldn't 'ChatType' be a string? Considering 'ChatType' in 'GetChatMessages' is a string, I would think so.
{*******************************************************************************
function GetChatMessages(ChatType: string; Visible, NoName: Boolean): TStringArray;
By: lordsaturn
Description: Gets all chat messages using interfaces according to params.
Valid ChatType Params:
'chat', 'normal': Normal chat
'pm', 'private': Private messages
'trade': Trade chat
'black', 'message': Black chat messages
'all': All of the above
*******************************************************************************}
function GetChatMessages(ChatType: Integer; Visible, NoName: Boolean): TStringArray;
var
I, L: integer;
FindStr, tmp, s: string;
begin
Result := [];
case (ChatType) of
CHAT_TYPE_NORMAL: FindStr := '<col=0000ff>';
CHAT_TYPE_CHATTER: FindStr := '<col=800000>';
CHAT_TYPE_PRIVATE: FindStr := '<col=800080>';
CHAT_TYPE_SYSTEM: FindStr := 'blk';
CHAT_TYPE_ALL: FindStr := 'all';
else
begin
srl_Warn('GetChatMessages', ToStr(ChatType)+' is not a valid chat type.',
warn_AllVersions);
Exit;
end;
end;
SetArrayLength(Result, 102);
for I := 282 downto 180 do
begin
s := GetInterfaceText(137, I);
if (s <> '') and ((Pos(FindStr, s) <> 0) or (FindStr = 'blk') or (FindStr = 'all')) then
begin
s := Replace(s, '<img=3>', ''); //quick chat
Tmp := s;
s := TrimHTML(s);
if ((FindStr = 'blk') and (Tmp <> s)) then Continue;
if NoName and (FindStr = '<col=0000ff>') then
Delete(s, 1, Pos(':', s)+1);
Result[L] := s;
Inc(L);
end;
end;
if Visible then
if L > 8 then
L := 8;
SetArrayLength(Result, L);
end;