From SRL (using tesseract) (using https://github.com/WarPie/SimpleOCR), derive as you wish:
Simba Code:
(*
Chatbox.GetTextOnLine
~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSChatbox.GetTextOnLine(line: Int32; colors:TIntegerArray = CHATBOX_COLORS): String;
Returns the text at the given line ``[0..8]``. 8 is the last line (the input-field)
.. note:: by slacky
Example:
.. code-block:: pascal
// returns the text at line 6
chatbox.GetTextOnLine(6);
*)
function TRSChatbox.GetTextOnLine(line: Int32; colors:TIntegerArray = CHATBOX_COLORS): String;
var
i,bmp: Int32;
textArr,temp: TPointArray;
B: TBox := Self.FLines[line];
begin
for i:=0 to High(colors) do
begin
FindColorsTolerance(temp, colors[i], B.x1,B.y1,B.x2,B.y2, 0);
textArr := CombineTPA(textArr, temp);
end;
if Length(textArr) = 0 then
Exit;
OffsetTPA(textArr, [-B.x1,-B.y1]);
BMP := CreateBitmap(B.x2-B.x1+1,B.y2-B.y1+2);
DrawTPABitmap(BMP,textArr,255);
Result := OCR.RecognizeEx(BitmapToMatrix(bmp),TCompareRules([255]), SmallFont);
FreeBitmap(bmp);
end;
https://github.com/SRL/SRL/blob/mast.../chatbox.simba
Aerolib:
Simba Code:
(*
GetChatBoxText
~~~~~~~~~~~~~~
.. code-block:: pascal
function getChatBoxText(Line, TextCol: Integer): string;
Gets text on the line Line with colour TextCol.
(Line 1 is the top, Line 8 is the bottom line).
Colours:
- clMessage/clBlack - Black text messages ("Oh Dear you are dead", etc).
- clChat/clBlue - Chat messages from you and other players.
- clTrade/clPurple - Colour of trade request text.
- clFriend - Colour of friend and clan chat.
Works with other colours too.
.. note::
by ZephyrsFury
Last modified: 23/1/14 by Flight
Example:
.. code-block:: pascal
*)
function getChatBoxText(Line, TextCol: Integer): string;
var
B : TBox;
P : TPoint;
bCol : TColEx;
cArr : TPointArray;
begin
Result := '';
P := getTextCoords(Line);
bCol.create(TextCol, 0);
if bCol.findAllIn(toBox(MCX1,P.y,MCX2,P.y+13), cArr) then
begin
B := cArr.getBounds();
result := Trim(getTextAtExWrap(b.x1-1,p.y,B.x2+1,p.y+13,0,5,2,TextCol,0,SmallChars07));
end;
end;
https://github.com/J-Flight/AeroLib/...ore/Chat.simba