
Originally Posted by
sandos1234
a basic template would be something like
SCAR Code:
begin
if inchat('str lvl') then
case random(3) of
0:begin
typesend('60 :P');
end;
1:begin
typesend('60');
end;
2:begin
typesend('60 u?');
end;
end;
end;
Thats not bad, but it needs more that just one thing to respond to. Also, remember that you only need begins and ends if you are nesting more than one line.
Here is mine:
Put this in CAutoRespond.scar.
Use the SetupAutoResponder procedure in your script, and you have yourself a nice autoresponder.
Just make sure you call the setup, and the AutoRespond function in your antiban.
SCAR Code:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป AutoRespond Routines --//
//-----------------------------------------------------------------//
// * procedure SetupAutoResponder; // * by Nava2
// * function InChatArr(Text:TStringArray): Boolean; // * by WT-Fakawi & Nava2
// * function AutoRespond: Boolean; // * by Nava2
var
OldMessage : string; // Stores the old message so it doesn't respond again.
QnR : Array of Array [0..1] of TStringArray; // Array of questions and answers.
{*******************************************************************************
procedure SetupAutoResponder;
By: Nava2
Description: Allows user to set up Array for auto responder. Add more lines to
create more questions and answers. As well, the more answers the
better anti-ban it is. Please note, this procedure must be copied
into your script, then called.
Example:
procedure SetupAutoResponder;
begin
QnR[0][0] := ['level', 'lvl'];
QnR[0][1] := ['my level is ' + Players[CurrentPlayer].Integers[0]', 'GTFO NOOB'];
QnR[1][0] := ['hi', 'hey'];
QnR[1][1] := ['hello', 'T I T S OR G T F O'];
end;
*******************************************************************************}
{procedure SetupAutoResponder;
begin
QnR[0][0] := [];
QnR[0][1] := [];
end;}
{*******************************************************************************
function InChatArr(Text: TStringArray): Boolean;
By: WT-Fakawi & Nava2
Description: Grabs Last Chat Line and performs checks on occurence of text
*******************************************************************************}
function InChatArr(Text: TStringArray): Boolean;
var
i, H: integer;
s: string;
// This should probably be in Text.scar...
begin
H := High(Text);
for i := 0 to H do
begin
if (not (GetLastChatText(s))) then LastChatter(s);
Result := (Pos(Lowercase(Text[i]), (Lowercase(s)) > 0);
if Result then Break;
end;
end;
{*******************************************************************************
function AutoRespond : boolean;
By: Nava2
Description: Responds to assorted text. Will NOT respond to itself. Returns a
boolean so people can record how many responds if they would like.
*******************************************************************************}
function AutoRespond : boolean;
var
CurrentMessage, Name : string;
I, H : integer;
begin
GetLastChatText(CurrentMessage);
if CurrentMessage = OldMessage then exit;
OldMessage := CurrentMessage;
LastChatter(Name);
if Lowercase(Name) = Lowercase(Players[CurrentPlayer].name) then exit;
case random(4) of
0..2: begin
H := High(QnR);
for I := 0 to H do
if InChatArr(QnR[I][0]) then
begin
TypeSend(QnR[I][1][Random(High(QnR[I][1])]);
Result := true;
end;
end;
end;
end;
Good luck.