PDA

View Full Version : [INCLUDE] Auto Responder



Da 0wner
04-27-2008, 09:02 PM
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!
04-27-2008, 09:13 PM
Invalid attachment? Reup pl0x?

Harry
04-27-2008, 09:16 PM
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
04-27-2008, 09:18 PM
Yea, use the one that hy posted ;).

mixster
04-27-2008, 09:47 PM
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
04-27-2008, 09:50 PM
Nice

Zezi
04-27-2008, 09:57 PM
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?
04-27-2008, 10:40 PM
You could also just use CAutoRespond.scar, just overwrite it. Would allow you to use the Respond; procedure, too.

Santa_Clause
04-28-2008, 03:02 AM
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
04-28-2008, 06:04 AM
nice work kyle, very nice c0de well done :)

vikrant60
04-30-2008, 11:09 AM
Erm its alight, but i'll edit it myself thanks.

Da 0wner
04-30-2008, 02:19 PM
Wow...You don't even know how it works etc...

firefoxx
08-20-2008, 07:50 AM
Looks nice would this still work?

just thinking because its couple months old..

Magiic
08-20-2008, 08:16 AM
don't gravedigeven in the slightest test it yourself thats the point of it

Da 0wner
08-20-2008, 11:50 PM
Umm, I haven't scripted for a while but it should work?

Naum
08-21-2008, 10:13 AM
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
08-21-2008, 04:10 PM
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
08-22-2008, 06:37 AM
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
08-22-2008, 08:51 AM
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
08-22-2008, 03:17 PM
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
08-22-2008, 04:19 PM
Would this work then?

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

Da 0wner
08-22-2008, 11:02 PM
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
08-26-2008, 11:02 PM
should be Wc lvl. because the fact rs caps the first letters.