HoMoReXuaL
2012-07-08 18:17:30
This is what the code that Brandon gave me thankfully for checking who said a certain thing -
Brandon
SRL Member
King Black Dragon
Posts: 2,570
Join Date: Feb 2011
Location: Canada
07-06-2012, 04:54 PM
Simba Code:
{$I SRL/SRL.Simba}
{*
Author: Brandon.
Get's The Player's Name at the specified Line.
*}
Function GetPlayerName(Line: Integer): String;
var
TPA: TPointArray;
B: TBox;
P: TPoint;
Text: String;
begin
P:= TextCoords(Line);
If (FindColorsTolerance(TPA, CLBLACK, 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, CLBLACK, 0, SmallChars));
Result:= Copy(Text, 0, High(Text) - 2);
end;
end;
{*
Author: Brandon.
Gets the name of the player who said the text.
*}
Function GetPlayerWhoSaid(Text: String): String;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
I: Integer;
begin
For I:= 1 To 8 Do
begin
P := TextCoords(I);
If (FindColorsTolerance(TPA, CLBLUE, 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, CLBLUE, 0, SmallChars))) then
begin
Result:= GetPlayerName(I);
Break;
end;
end;
end;
end;
begin
SetupSRL;
writeln(GetPlayerWhoSaid('Brandon'));
end.
it works pretty well but now i am trying to make it work in the friends chat in the lobby, and in the lobby, the names are White and the text is Red, i was wondering what code i would need to change those colors because i tried changing it to CLWHITE and CLRED and it does not work, Any help would be great, thanks!
Brandon
SRL Member
King Black Dragon
Posts: 2,570
Join Date: Feb 2011
Location: Canada
07-06-2012, 04:54 PM
Simba Code:
{$I SRL/SRL.Simba}
{*
Author: Brandon.
Get's The Player's Name at the specified Line.
*}
Function GetPlayerName(Line: Integer): String;
var
TPA: TPointArray;
B: TBox;
P: TPoint;
Text: String;
begin
P:= TextCoords(Line);
If (FindColorsTolerance(TPA, CLBLACK, 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, CLBLACK, 0, SmallChars));
Result:= Copy(Text, 0, High(Text) - 2);
end;
end;
{*
Author: Brandon.
Gets the name of the player who said the text.
*}
Function GetPlayerWhoSaid(Text: String): String;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
I: Integer;
begin
For I:= 1 To 8 Do
begin
P := TextCoords(I);
If (FindColorsTolerance(TPA, CLBLUE, 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, CLBLUE, 0, SmallChars))) then
begin
Result:= GetPlayerName(I);
Break;
end;
end;
end;
end;
begin
SetupSRL;
writeln(GetPlayerWhoSaid('Brandon'));
end.
it works pretty well but now i am trying to make it work in the friends chat in the lobby, and in the lobby, the names are White and the text is Red, i was wondering what code i would need to change those colors because i tried changing it to CLWHITE and CLRED and it does not work, Any help would be great, thanks!