SRL Archive - Test corner

Function RespondTo(ChatText, Say: String): Boolean;


R0b0t1

2007-07-14 16:21:01

Searches for text in chat box, if found, returns true and answers with pre-defined response.

program New;
{.Include SRL/SRL.scar}

Function RespondTo(ChatText, Say: String): Boolean;
begin;
If (InChat(ChatText)) Then
begin;
Result:= True;
HumanText(Say, 5);
end else;
begin;
Result:= False;
end;
end;

begin
end.

Good idea? Answer with suggestions, comment, test results.

JAD

2007-07-14 17:17:30

The shorter the code, the faster it compiles so you can shorten it 2 lines by making it:


function RespondTo(ChatText, Say: String): Boolean;
begin
if(InChat(ChatText))then
begin
Result:= True;
HumanText(Say, 5);
end else
Result := False;
end;

=)

Bobarkinator

2007-07-14 18:27:45

Why do you put semicolans after you bold words? Plus InChat takes a bitmap of the line of text and checks it (if I remember right) so this might not be very fast.

nielsie95

2007-07-15 05:16:03

This is almost the same as your idea.. :)

JAD, this is a bit shorter;):

function RespondTo(ChatText, Say: String): Boolean;
begin
Result:= InChat(ChatText);
if Result then
HumanText(Say, 5);
end;

R0b0t1

2007-07-15 13:55:40

OMG! I WAS JUST PWNED!

I am SOOO not smart.