HoMoReXuaL
2012-07-06 11:58:31
Could somebody provide a built in method or a written procedure that gets the last text line from the rs chatbox, because when i use GetBlackChatMessage, It stores things like "? || _ ?" into my string..
2012-07-06 11:58:31
2012-07-06 19:10:16
if InChat('Bot') then
begin
PlaySound('C:/simba/alarm.wav');
writeln('WARNING: Someone may be talking to you!');
Wait(1000);
end; *It has FixChat before.2012-07-06 20:05:05
2012-07-06 20:54:33
{$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.
2012-07-06 21:23:53
2012-07-06 21:56:17
From: HoMoReXuaL
Wbout code for checking if a specific text was said in the last line
2012-07-06 22:09:09
2012-07-06 22:47:02
2012-07-06 23:09:48
From: Brandon
If you do not want it to search all 8 lines, then change the for-loop to:
For I:= 8 To 8 Do
Or replace it with I:= 8.
It wouldn't be so difficult if you tried to understand it.
2012-07-07 00:40:09