Here's a little snippet I made a while back:
Simba Code:
{$include_once srl/srl.simba}
{$include_once srl/srl/misc/debug.simba}
function GetChatBoxTextAnyColor(Line: Integer): array of string;
var
TempCTS, i: Integer;
P: TPoint;
B: TBox;
clearTPA, res: TPointArray;
Area51Colors: TIntegerArray;
begin
P := TextCoords(Line);
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(3);
B := IntToBox(MCX1 + 5, P.y, MCX2 - 19, P.y + 13);
FindColorsTolerance(clearTPA, 7705763, B.X1, B.Y1, B.X2, B.Y2, 22);
ReturnPointsNotInTPAWrap(clearTPA, B, res);
debugTPA(res, '');
Area51Colors := GetColors(res);
ClearSameIntegers(Area51Colors);
SetArrayLength(result, Length(Area51Colors));
B := GetTPABounds(res);
for i := 0 to high(Area51Colors) do
result[i] := Trim(GetTextAtExWrap(B.X1 - 1, P.y, B.X2 + 1, P.y + 13,
0, 5, 2, Area51Colors[i], 0, SmallChars));
ColorToleranceSpeed(1);
ColorToleranceSpeed(TempCTS);
end;
function GetCBTxt(line: integer): string;
begin
result := Implode(' ', GetChatBoxTextAnyColor(line));
{
remove := ['', '', '', '', '', '', '', '', '', ''];
for i := 0 to high(remove) do
result := ReplaceWrap(result, remove[i], '', []);
}
end;
begin
SetupSRL;
Writeln(GetCBTxt(8));
end.
Note, I didn't bother filtering out the unidentifiable characters from the string (doesn't make much a difference unless you actually need to use the strings later on).