SRL Archive - Research & Development Lounge

[INCLUDE] Auto Responder


Da 0wner

2008-04-27 17:02:22

This is an autoresponder that I made.

Instructions

1. Put {.include SRL/SRL/misc/CAutoRespond.scar} at the top of your script.

2. Make a procedure called SetupAutoResponder;

Make it like so


procedure SetupAutoResponder;
begin
SetAutoResponderLength(0);
RespondTo[0] := [];
RespondWith[0] := [];
end;

Adding as many responses as you want as long as you make the SetAutoResponderLength(0); to the number of responses.

Then when you want to use it you just call AutoResponder; and it is a boolean so you can do if AutoResponder then inc(AutoResponses).

Run this script


program New;

var

FileNum : integer;

begin

FileNum := RewriteFile(AppPath + 'Includes\SRL\SRL\misc\CAutoRespond.scar', false);
WriteFileString(FileNum, GetPage('http://kwscripts.freehostia.com/Da0wnerResponder.scar'));
closefile(FileNum);
writeln('File downloaded successfully to ' + AppPath + 'Includes\SRL\SRL\misc\CAutoRespond.scar.');
end.

EvilChicken!

2008-04-27 17:13:54

Invalid attachment? Reup pl0x?

Harry

2008-04-27 17:16:43

How about you EvilChicken! ;) It works fine for me.


program New;

var

FileNum : integer;

begin

if FileExists(AppPath + 'Includes\SRL\SRL\misc\Da0wnerResponder.scar') then
begin
case GetApplication.MessageBox('You already seem to have the autoresponder. Download anyway?', 'Download Anyway?', 4) of
mrNo : TerminateScript;
end;
end;
FileNum := RewriteFile(AppPath + 'Includes\SRL\SRL\misc\Da0wnerResponder.scar', false);
WriteFileString(FileNum, GetPage('http://kwscripts.freehostia.com/Da0wnerResponder.scar'));
closefile(FileNum);
writeln('File downloaded successfully to ' + AppPath + 'Includes\SRL\SRL\misc\Da0wnerResponder.scar.');
end.

Da 0wner

2008-04-27 17:18:00

Yea, use the one that hy posted ;).

mixster

2008-04-27 17:47:19

I don't see why it has to be an actual file rather than just included as a procedure/function. Anyway, it's pretty basic and it looks like it may respond to the same phrase multiple times. Other than that, it looks like it could save some time for some people, so it's good :)

ShowerThoughts

2008-04-27 17:50:07

Nice

Zezi

2008-04-27 17:57:15

It worked for me, i like this idea actually :S

But an entire file just for the single thing :\

Are you planning on expanding on this :\

Wizzup?

2008-04-27 18:40:06

You could also just use CAutoRespond.scar, just overwrite it. Would allow you to use the Respond; procedure, too.

Santa_Clause

2008-04-27 23:02:40

From: Wizzup?
You could also just use CAutoRespond.scar, just overwrite it. Would allow you to use the Respond; procedure, too.


For some weird reason, people are dying to get their names into the include.

NiCbaZ

2008-04-28 02:04:37

nice work kyle, very nice c0de well done :)

vikrant60

2008-04-30 07:09:45

Erm its alight, but i'll edit it myself thanks.

Da 0wner

2008-04-30 10:19:27

Wow…You don't even know how it works etc…

firefoxx

2008-08-20 03:50:01

Looks nice would this still work?

just thinking because its couple months old..

Magiic

2008-08-20 04:16:02

don't gravedigeven in the slightest test it yourself thats the point of it

Da 0wner

2008-08-20 19:50:58

Umm, I haven't scripted for a while but it should work?

Naum

2008-08-21 06:13:50

No it doesn't my friend,
:)
{*******************************************************************************
function InChatMulti(text : TStringArray) : boolean;
By: Da 0wner
Description: Returns true if any of the text is found in last line of chat box.
*******************************************************************************}

function InChatMulti(text : TStringArray) : boolean;
var
i : integer;
begin
for i := 0 to high(Text) do
begin
if InChat(text[i]) then
begin
if FindBlackChatMessage(Players[CurrentPlayer].nick) then exit; // lol?
result := true;
exit;
end;
end;
end;

Shouldn't it be
{*******************************************************************************
function InChatMulti(text : TStringArray) : boolean;
By: Da 0wner
Description: Returns true if any of the text is found in last line of chat box.
*******************************************************************************}

function InChatMulti(text : TStringArray) : boolean;
var
i : integer;
begin
for i := 0 to high(Text) do
begin
if InChat(text[i]) then
begin
if Not FindBlackChatMessage(Players[CurrentPlayer].nick) then exit
else
result := true;
exit;
end;
end;
end;

becuase it will exit if it finds the nickname rendering it useless :).

Nava2

2008-08-21 12:10:09

From: NaumanAkhlaQ
No it doesn't my friend,
:)
{*******************************************************************************
function InChatMulti(text : TStringArray) : boolean;
By: Da 0wner
Description: Returns true if any of the text is found in last line of chat box.
*******************************************************************************}

function InChatMulti(text : TStringArray) : boolean;
var
i : integer;
begin
for i := 0 to high(Text) do
begin
if InChat(text[i]) then
begin
if FindBlackChatMessage(Players[CurrentPlayer].nick) then exit; // lol?
result := true;
exit;
end;
end;
end;

Shouldn't it be
{*******************************************************************************
function InChatMulti(text : TStringArray) : boolean;
By: Da 0wner
Description: Returns true if any of the text is found in last line of chat box.
*******************************************************************************}

function InChatMulti(text : TStringArray) : boolean;
var
i : integer;
begin
for i := 0 to high(Text) do
begin
if InChat(text[i]) then
begin
if Not FindBlackChatMessage(Players[CurrentPlayer].nick) then exit
else
result := true;
exit;
end;
end;
end;

becuase it will exit if it finds the nickname rendering it useless :).


To be completely honest, checking for nicks in this function is useless. The fastest way would be to do that else where.

Here is my InChatArr(Text: TStringArray): Boolean;

function InChatArr(Text: TStringArray): Boolean;

var
I, H : integer;
s : string;

begin
H := High(Text);
if (not (GetLastChatText(s))) then LastChatter(s);
for I := 0 to H do
if (Pos(Lowercase(Text[I]), (Lowercase(s)) )> 0) then
begin
Result := true;
Exit;
end;
end;

Da 0wner

2008-08-22 02:37:51

Umm, this is old and also, mine is right, so that it won't respond to itself. So yours would be wrong. And yours may be better than mine but I don't really care this is like 4 months old. But that is there so that it won't respond to itself.

Daniel

2008-08-22 04:51:35

From: Da 0wner
Umm, this is old and also, mine is right, so that it won't respond to itself. So yours would be wrong. And yours may be better than mine but I don't really care this is like 4 months old. But that is there so that it won't respond to itself.

It doesn't even respond to itself ;) InChat checks if your nick is found in the Black Text (i think), since it's declared in Players[somerandomnumber].Nick:='';

Nava2

2008-08-22 11:17:30

[QUOTE=Dan's The Man;452815]It doesn't even respond to itself ;) InChat checks if your nick is found in the Black Text (i think), since it's declared in Players[somerandomnumber].Nick:='';

Exactly.

dallas574

2008-08-22 12:19:49

Would this work then?

procedure SetupAutoResponder;
begin
SetAutoResponderLength(0);
RespondTo[0] := [wc lvl?];
RespondWith[0] := [30];
end;

Da 0wner

2008-08-22 19:02:09

Oh yea, sorry, I haven't scripted in a long time. And Nava if you knew that then you should have said that :).

And Dallas

This would work

procedure SetupAutoResponder;
begin
SetAutoResponderLength(0);
RespondTo[0] := ['wc lvl', 'wc levels', 'woodcuttin lvl'];
RespondWith[0] := ['30'];
end;

Claymore

2008-08-26 19:02:04

should be Wc lvl. because the fact rs caps the first letters.