SRL Archive - General

Need quick help w/ my script please


HoMoReXuaL

2012-07-17 13:55:48

Hi guys, this is my code that is supposed to get the text on the last line in the chatbox (Props to Brandon). I have a few things i need help with.
1. It does not read the text in the middle of the screen, I have to drag the box into the upper left hand corner of my screen for it to find the chatbox
2. When I Change the value of the Variable I in the function GetPlayerWhoSaid, to 4 or even 10, it does not have an effect on the line it reads as it seems to read the 4th line on the chatbox when i want it to read the last or 8th.

ANY ANSWERS TO THOSE QUESTIONS WOULD BE AWESOME!

CODE BELOW—- AND THANKS FOR YOUR TIME!

Function GetPlayerName(Line: Integer): String;
var
TPA: TPointArray;
B: TBox;
P: TPoint;
Text: String;
begin
P:= TextCoords(Line);
If (FindColorsTolerance(TPA, 0, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(TPA);
Text := Trim(GetTextAtExWrap(B.X1 - 1, P.Y, B.X2 + 1, P.Y + 13, 0, 5, 2, 0, 0, SmallChars));
Result:= Copy(Text, 0, High(Text) - 2);
end;
end;


Function GetPlayerWhoSaid(Text: String): String;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
I: Integer;

begin
For I:= 8 To 8 Do
begin
P := TextCoords(I);
If (FindColorsTolerance(TPA, 239, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(TPA);
If (Text = Trim(GetTextAtExWrap(B.X1 - 1, P.Y, B.X2 + 1, P.Y + 13, 0, 5, 2, 239, 0, SmallChars))) then
begin
Result:= GetPlayerName(I);
Break;
end;
end;
end;
end;