Rich
2009-05-11 22:26:16
These are two functions that will return true if they have found text, and replied to it.
Of course they could be used like:
Comments?
Richard
//function FindReply(Finds : TStringArray; Replies : TStringArray) : Boolean;
//By R1ch
//Example: if FindReply(['hi', 'hey'], ['hello', 'wassup']) then
function FindReply(Finds : TStringArray; Replies : TStringArray) : Boolean;
var
F, R : Integer;
begin
for F:= 0 to High(Finds) do
if InChat(Finds[F]) then
begin
R:= Random(High(Replies));
TypeSend(Replies[R]);
Result:= True;
end else
Result:= False;
end;
//function FindReplyAnyLine(Finds, Replies : TStringArray; OnLine, TextColor : Integer;) : Boolean;
//By R1ch
//Example: if FindReplyAnyline(['hi', 'hey'], ['hello', 'wassup'], 8, clBlue) then
function FindReplyAnyLine(Finds, Replies : TStringArray; OnLine, TextColor : Integer;) : Boolean;
var
F, R : Integer;
begin
for F:= 0 to High(Finds) do
if FindChatBoxText(Finds[F], OnLine, TextColor) then
begin
R:= Random(High(Replies));
TypeSend(Replies[R]);
Result:= True;
end else
Result:= False;
end;Of course they could be used like:
var
Text, Reply : TStringArray;
begin
Text:= ['hi', 'hey']
Reply:= ['hello', 'wassup']
if FindReply(Text, Reply) then...Comments?
Richard