2 functions for autoresponders
!:
SCAR Code:
Function GetChatTexts(ChatType : (Blue, Black, BlueAndBlack)): TStringArray;
Var
Info : TIntegerArray;
I : Integer;
TPA : TPointArray;
Begin
Case ChatType Of
Blue: Info := [16711680];
Black : Info := [0];
BlueAndBlack: Info := [16711680, 0];
Else
srl_Warn('GetChatTexts', 'Invalid option', warn_AllVersions);
End;
SetLength(TPA, 9);
For I := 1 To 8 Do
Begin
TPA[I] := TextCoords(I);
End;
SetLength(Result, 9);
If GetArrayLength(Info) = 1 Then
Begin
For I := 1 To 8 Do
Begin
Result[I] := Trim(GetTextAtEx(TPA[I].X - 2, TPA[I].Y - 2, 0, SmallChars, False, False, 0, 1, Info[0], 60, False, tr_AllChars));
End;
End Else
Begin
For I := 1 To 8 Do
Begin
Result[I] := Trim(GetTextAtEx(TPA[I].X - 2, TPA[I].Y - 2, 0, SmallChars, False, False, 0, 1, Info[1], 60, False, tr_AllChars)) + Trim(GetTextAtEx(TPA[I].X - 2, TPA[I].Y - 2, 0, SmallChars, False, False, 0, 1, Info[0], 60, False, tr_AllChars));
End;
End;
End;
Get all texts(Blue, Black, Blue or Black) from the 8 text lines in the chat box.
SCAR Code:
Function InChatRespond(ChatType : (Blue, Black, BlueAndBlack); NeededChat,ToSay : String): Boolean;
Var
I : Integer;
LastChat : TStringArray;
Begin
LastChat := GetChatTexts(ChatType);
For I := 1 To 9 Do
Begin
If Pos(Lowercase(NeededChat), Lowercase(LastChat[I])) <> 0 Then
Begin
Result := True;
TypeSend(ToSay);
Exit;
End;
End;
Result := False;
End;
For example:
SCAR Code:
If InChatRespond(Blue, 'hi', 'whatsup') Then Resonds := Responds + 1;

For random case reponder's:
SCAR Code:
Procedure Responder;
Var
NeededChats : TStringArray;
I : Integer;
Begin
NeededChats := ['hi', 'hello', 'hiya', 'hey', 'sup'];
For I := 0 To High(NeededChats) Do
Begin
If InChatRespond(Blue, NeededChats[I], NeededChats[Random(Length(NeededChats))]) Then Break;
End;
End;
^You Can adapt NeededChats to your autoresponder^