Goes without saying not to leak this :p Don't know if it will still work though I may have made some changes.
{
Just set usenewrespond to true in SRL.scar to use this file
use the Respond; function in your script or call FindNormalRandoms
on editing this include: be careful with adding too many trigger words;
every one of those are checked on every chat line, but go crazy with replies
you can/should put spaces in triggers if applicable
there is a space added to beginning and end of TheLine automagically
needed responses:
fight me/wild
food
it is possible to add specific responses inside your script(more skill related?)
just increase the array by one and add responses as below
masquerader
}
// MADE BY ZYT3X. FEEL FREE TO EDIT, BUT DO NOT COMPLAIN ABOUT IT NOT WORKING IF YOU DO!
type TAIPlayer = record
Name : String;
ID : Extended;
end;
AIBot = record
Players : array of TAIPlayer;
end;
var
AI : AIBot;
AI_Setup : Boolean;
Names: TStringArray;
const
//Extendeds
AI_SERVERID = 53455.25645524944;
function AI_GetIDFromName(Name : String): Extended;
var
I, H : Integer;
begin
H := High(AI.Players);
for I := 0 to H do
if AI.Players[I].Name = Name then
Result := AI.Players[I].ID;
end;
function AI_SetupNewPlayer(Name, Input : String): Boolean;
var
I, H : Integer;
E : Extended;
S : String;
begin
Result := False;
if not AI_Setup then Exit;
S := IntToStr(Random(99999) + 1) + '.' + IntToStr(Random(99999) + 1);
try
E := StrToFloat(S);
except
WriteLn(S);
E := 1.1;
end;
H := High(AI.Players);
for I := 0 to H do
begin
if (AI.Players[I].ID = E) then
begin
E := StrToFloat(IntToStr(Random(99999) + 1) + '.' + IntToStr(Random(99999) + 1));
I := 0;
end;
end;
SetLength(AI.Players, H+2);
H := High(AI.Players);
AI.Players[H].Name := Name;
AI.Players[H].ID := E;
Result := True;
end;
function AI_GetOutput(Input : String; ID : Extended) : String;
begin
Result := '';
if not AI_Setup then Exit;
Result := Between('<B>splotchy ==> ', '</B>', GetPage('http://www.cooldictionary.com/splotchy.mpl?input=' + Input + '&session_id=' + FloatToStr(ID) + '&Submit=Submit'));
Result := Replace(Result, '&#' + '39;', '''');
end;
function AI_TalkedToPlayerBefore(Name : String) : Boolean;
var
I, H : Integer;
begin
Result := False;
if not AI_Setup then Exit;
H := High(AI.Players);
for I := 0 to H do
if AI.Players[I].Name = Name then
begin
Result := True;
Exit;
end;
end;
function AI_Respond(Name, Input : String): Boolean;
var
S : String;
E : Extended;
begin
Result := False;
if not AI_Setup then Exit;
if AI_TalkedToPlayerBefore(Name) then
E := AI_GetIDFromName(Name)
else
if not AI_SetupNewPlayer(Name, Input) then
Exit;
S := AI_GetOutput(Input, E);
Result := S <> '';
if Result then
begin
TypeSend(S);
WriteLn('Talked to ' + Name + ': ' + S);
end;
end;
function AI_ResponderIsWorking : Boolean;
begin
Result := AI_GetOutput(' ', AI_SERVERID) <> '';
end;
function SetupAIResponder : Boolean;
begin
SetArrayLength(AI.Players, 1);
Result := AI_ResponderIsWorking;
AI_Setup := Result;
end;
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
//////////////////////// BEGIN SRL DEV RESPONDER
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
type
Response=record
Name:string;
Trigger:array of string;
Reply:array of string;
Counter:Integer;
Time:Integer;
end;
LevelResponse=record
Name:string;
Short:array of string;
Time:Integer;
end;
var
AutoText:array of Response;
AutoLevels:array[1..21] of LevelResponse;
var
UseAutoResponder: Boolean;
const
RespWait=120;
//time to wait(seconds) between responding to triggers of same type
{*******************************************************************************
procedure LoadNewWords;
By:Masquerader
Description: Loads the words to say into memory
*******************************************************************************}
procedure LoadNewWords;
begin
SetArrayLength(AutoText,15)
AutoText[0].Name:='report';
SetArrayLength(AutoText[0].Trigger,1)
AutoText[0].Trigger[0]:= 'report';
SetArrayLength(AutoText[0].Reply,9)
AutoText[0].Reply[0] := 'why ';
AutoText[0].Reply[1] := 'you are too kind ';
AutoText[0].Reply[2] := 'ow ok. ';
AutoText[0].Reply[3] := 'why ';
AutoText[0].Reply[4] := 'who me ';
AutoText[0].Reply[5] := 'nooo dont ';
AutoText[0].Reply[6] := 'please ';
AutoText[0].Reply[7] := 'ty ';
AutoText[0].Reply[8] := 'huh what. sry chatting...';
////////////////////////////////////////////////////////////////////////////////
AutoText[1].Name:= 'auto'
SetArrayLength(AutoText[1].Trigger,3)
AutoText[1].Trigger[0]:= 'auto';
AutoText[1].Trigger[1]:= 'bot';
AutoText[1].Trigger[2]:= 'macro';
SetArrayLength(AutoText[1].Reply,8)
AutoText[1].Reply[0] := 'huh...me';
AutoText[1].Reply[1] := 'no, lol';
AutoText[1].Reply[2] := 'i am not autoing';
AutoText[1].Reply[3] := 'autoing ruins the game';
AutoText[1].Reply[4] := 'autoers should be banned =p';
AutoText[1].Reply[5] := 'i h8 autoers';
AutoText[1].Reply[6] := '=/ grrr. no way';
AutoText[1].Reply[7] := 'busy chatting..';
////////////////////////////////////////////////////////////////////////////////
AutoText[2].Name:='hi';
SetArrayLength(AutoText[2].Trigger,7)
AutoText[2].Trigger[0]:=' hi '
AutoText[2].Trigger[1]:='ello '
AutoText[2].Trigger[2]:='sup'
AutoText[2].Trigger[3]:=' yo '
AutoText[2].Trigger[4]:='howdy'
AutoText[2].Trigger[5]:='hey'
AutoText[2].Trigger[6]:='s up'
SetArrayLength(AutoText[2].Reply,7)
AutoText[2].Reply[0]:='hi'
AutoText[2].Reply[1]:='hello'
AutoText[2].Reply[2]:='sup'
AutoText[2].Reply[3]:='yo'
AutoText[2].Reply[4]:='howdy'
AutoText[2].Reply[5]:='hey'
AutoText[2].Reply[6]:='good day'
////////////////////////////////////////////////////////////////////////////////
AutoText[3].Name:='name'
SetArrayLength(AutoText[3].Trigger,1);
AutoText[3].Trigger[0]:='' //this gets set to the nick in Login;
//at the same time as NickNameBMP
SetArrayLength(AutoText[3].Reply,9)
AutoText[3].Reply[0] := 'what';
AutoText[3].Reply[1] := 'no';
AutoText[3].Reply[2] := 'go away';
AutoText[3].Reply[3] := 'huh';
AutoText[3].Reply[4] := 'busy';
AutoText[3].Reply[5] := 'leave me alone.';
AutoText[3].Reply[6] := 'heey';
AutoText[3].Reply[7] := 'dont talk to me';
AutoText[3].Reply[8] := 'stfu';
////////////////////////////////////////////////////////////////////////////////
AutoText[4].Name:='bye';
SetArrayLength(AutoText[4].Trigger,7)
AutoText[4].Trigger[0]:='bye'
AutoText[4].Trigger[1]:='g2g'
AutoText[4].Trigger[2]:='gtg'
AutoText[4].Trigger[3]:='later'
AutoText[4].Trigger[4]:='l8r'
AutoText[4].Trigger[5]:='cya'
AutoText[4].Trigger[6]:='c ya'
SetArrayLength(AutoText[4].Reply,7)
AutoText[4].Reply[0]:='bye'
AutoText[4].Reply[1]:='cya'
AutoText[4].Reply[2]:='by'
AutoText[4].Reply[3]:='later'
AutoText[4].Reply[4]:='see you'
AutoText[4].Reply[5]:='goodbye'
AutoText[4].Reply[6]:='nightynight'
////////////////////////////////////////////////////////////////////////////////
AutoText[5].Name:='lol';
SetArrayLength(AutoText[5].Trigger,7)
AutoText[5].Trigger[0]:='lol'
AutoText[5].Trigger[1]:='haha'
AutoText[5].Trigger[2]:='hehe'
AutoText[5].Trigger[3]:='rofl'
AutoText[5].Trigger[4]:='rotfl'
AutoText[5].Trigger[5]:='lmao'
AutoText[5].Trigger[6]:='lmfao'
SetArrayLength(AutoText[5].Reply,8)
AutoText[5].Reply[0]:='lol'
AutoText[5].Reply[1]:='haha'
AutoText[5].Reply[2]:='rofl'
AutoText[5].Reply[3]:='hehe'
AutoText[5].Reply[4]:='lmao'
AutoText[5].Reply[5]:='rotfl'
AutoText[5].Reply[6]:='=]'
AutoText[5].Reply[7]:='lmfao'
////////////////////////////////////////////////////////////////////////////////
AutoText[6].Name:='noob';
SetArrayLength(AutoText[6].Trigger,4)
AutoText[6].Trigger[0]:='noob'
AutoText[6].Trigger[1]:='newb'
AutoText[6].Trigger[2]:='nub'
AutoText[6].Trigger[3]:='n00b'
SetArrayLength(AutoText[6].Reply,10)
AutoText[6].Reply[0]:='u r the noob'
AutoText[6].Reply[1]:='ubernoob'
AutoText[6].Reply[2]:='n00b'
AutoText[6].Reply[3]:='yeahyeah'
AutoText[6].Reply[4]:='noobs are the future'
AutoText[6].Reply[5]:='i dont get it'
AutoText[6].Reply[6]:='nvm'
AutoText[6].Reply[7]:='blahblah'
AutoText[6].Reply[8]:='we need more noobs'
AutoText[6].Reply[9]:='it happens'
////////////////////////////////////////////////////////////////////////////////
AutoText[7].Name:='team';
SetArrayLength(AutoText[7].Trigger,1)
AutoText[7].Trigger[0]:='team'
SetArrayLength(AutoText[7].Reply,10)
AutoText[7].Reply[0]:='no team'
AutoText[7].Reply[1]:='no'
AutoText[7].Reply[2]:='i work alone'
AutoText[7].Reply[3]:='nah'
AutoText[7].Reply[4]:='nty'
AutoText[7].Reply[5]:='why'
AutoText[7].Reply[6]:='nah nvm'
AutoText[7].Reply[7]:='i kill solo'
AutoText[7].Reply[8]:='lemme be'
AutoText[7].Reply[9]:='noho'
////////////////////////////////////////////////////////////////////////////////
AutoText[8].Name:='friend';
SetArrayLength(AutoText[8].Trigger,5)
AutoText[8].Trigger[0]:='gf'
AutoText[8].Trigger[1]:='girlf'
AutoText[8].Trigger[2]:='bf'
AutoText[8].Trigger[3]:='boyf'
AutoText[8].Trigger[4]:='friend'
SetArrayLength(AutoText[8].Reply,10)
AutoText[8].Reply[0]:='go away'
AutoText[8].Reply[1]:='no i dont want to be your friend'
AutoText[8].Reply[2]:='no friend'
AutoText[8].Reply[3]:='no. i live alone'
AutoText[8].Reply[4]:='never'
AutoText[8].Reply[5]:='i dont get it'
AutoText[8].Reply[6]:='no. leave me alone'
AutoText[8].Reply[7]:='i already have a friend'
AutoText[8].Reply[8]:='no. stop it'
AutoText[8].Reply[9]:='i dont think so'
////////////////////////////////////////////////////////////////////////////////
AutoText[9].Name:='buy';
SetArrayLength(AutoText[9].Trigger,2)
AutoText[9].Trigger[0]:='uy yo'
AutoText[9].Trigger[1]:='uy ur'
SetArrayLength(AutoText[9].Reply,9)
AutoText[9].Reply[0]:='no'
AutoText[9].Reply[1]:='nfs'
AutoText[9].Reply[2]:='go away'
AutoText[9].Reply[3]:='what'
AutoText[9].Reply[4]:='not for sale'
AutoText[9].Reply[5]:='get lost'
AutoText[9].Reply[6]:='stop bothering me'
AutoText[9].Reply[7]:='noooo.....'
AutoText[9].Reply[8]:='im busy'
////////////////////////////////////////////////////////////////////////////////
AutoText[10].Name:='grr';
SetArrayLength(AutoText[10].Trigger,7)
AutoText[10].Trigger[0]:='grr'
AutoText[10].Trigger[1]:='f off'
AutoText[10].Trigger[2]:='come on'
AutoText[10].Trigger[3]:='meanie'
AutoText[10].Trigger[4]:='meany'
AutoText[10].Trigger[5]:='re mean'
AutoText[10].Trigger[6]:='r mean'
SetArrayLength(AutoText[10].Reply,9)
AutoText[10].Reply[0]:='no'
AutoText[10].Reply[1]:='mine'
AutoText[10].Reply[2]:='i dont share'
AutoText[10].Reply[3]:='sorry'
AutoText[10].Reply[4]:='im tryin to lvl up'
AutoText[10].Reply[5]:='i am mean'
AutoText[10].Reply[6]:='sry'
AutoText[10].Reply[7]:='it wont take long'
AutoText[10].Reply[8]:='i am an ahole'
////////////////////////////////////////////////////////////////////////////////
AutoText[11].Name:='nice';
SetArrayLength(AutoText[11].Trigger,1)
AutoText[11].Trigger[0]:='nice'
SetArrayLength(AutoText[11].Reply,7)
AutoText[11].Reply[0]:='yes'
AutoText[11].Reply[1]:='very nice'
AutoText[11].Reply[2]:='indeed'
AutoText[11].Reply[3]:='yup'
AutoText[11].Reply[4]:='good'
AutoText[11].Reply[5]:='nice indeed'
AutoText[11].Reply[6]:='very good'
////////////////////////////////////////////////////////////////////////////////
AutoText[12].Name:='go away';
SetArrayLength(AutoText[12].Trigger,1)
AutoText[12].Trigger[0]:='go aw'
SetArrayLength(AutoText[12].Reply,6)
AutoText[12].Reply[0]:='no'
AutoText[12].Reply[1]:='i dont'
AutoText[12].Reply[2]:='i stay'
AutoText[12].Reply[3]:='never'
AutoText[12].Reply[4]:='i dont go away'
AutoText[12].Reply[5]:='im staying'
////////////////////////////////////////////////////////////////////////////////
AutoText[13].Name:='trade';
SetArrayLength(AutoText[13].Trigger,2)
AutoText[13].Trigger[0]:='trade'
AutoText[13].Trigger[1]:='look'
SetArrayLength(AutoText[13].Reply,7)
AutoText[13].Reply[0]:='i dont want to trade'
AutoText[13].Reply[1]:='busy'
AutoText[13].Reply[2]:='nty'
AutoText[13].Reply[3]:='dont trade sry'
AutoText[13].Reply[4]:='no ty'
AutoText[13].Reply[5]:='no trade'
AutoText[13].Reply[6]:='no thanks'
////////////////////////////////////////////////////////////////////////////////
AutoText[14].Name:='begging';
SetArrayLength(AutoText[14].Trigger,3)
AutoText[14].Trigger[0]:='m poor'
AutoText[14].Trigger[1]:='give me'
AutoText[14].Trigger[2]:='free stuff'
SetArrayLength(AutoText[14].Reply,7)
AutoText[14].Reply[0]:='beggar'
AutoText[14].Reply[1]:='get a job'
AutoText[14].Reply[2]:='nope'
AutoText[14].Reply[3]:='go away'
AutoText[14].Reply[4]:='blahblah'
AutoText[14].Reply[5]:='go get urself a job'
AutoText[14].Reply[6]:='i dont have any'
// Note on AutoLevels array:
// .Name is the full name, as found in GameTab.scar (DONT EDIT)
// .Short is 3-4 letters out of the name, or whatever players use
AutoLevels[1].Name := 'attack'
SetArrayLength(AutoLevels[1].Short,2)
AutoLevels[1].Short[0]:='atk';
AutoLevels[1].Short[1]:='att';
AutoLevels[2].Name := 'strength'
SetArrayLength(AutoLevels[2].Short,1)
AutoLevels[2].Short[0]:='str';
AutoLevels[3].Name := 'defence'
SetArrayLength(AutoLevels[3].Short,1)
AutoLevels[3].Short[0]:='def';
AutoLevels[4].Name := 'range'
SetArrayLength(AutoLevels[4].Short,1)
AutoLevels[4].Short[0]:='rang';
AutoLevels[5].Name := 'prayer'
SetArrayLength(AutoLevels[5].Short,1)
AutoLevels[5].Short[0]:='pray';
AutoLevels[6].Name := 'magic'
SetArrayLength(AutoLevels[6].Short,1)
AutoLevels[6].Short[0]:='mag'; //magic,mage
AutoLevels[7].Name := 'runecrafting'
SetArrayLength(AutoLevels[7].Short,2)
AutoLevels[7].Short[0]:='rc';
AutoLevels[7].Short[1]:='runec';
AutoLevels[8].Name := 'hitpoints'
SetArrayLength(AutoLevels[8].Short,2)
AutoLevels[8].Short[0]:='hp';
AutoLevels[8].Short[1]:='hit';
AutoLevels[9].Name := 'agility'
SetArrayLength(AutoLevels[9].Short,1)
AutoLevels[9].Short[0]:='agil';
AutoLevels[10].Name := 'herblore'
SetArrayLength(AutoLevels[10].Short,1)
AutoLevels[10].Short[0]:='herb';
AutoLevels[11].Name := 'thieving'
SetArrayLength(AutoLevels[11].Short,2)
AutoLevels[11].Short[0]:='heiv';
AutoLevels[11].Short[1]:='hiev';
AutoLevels[12].Name := 'crafting'
SetArrayLength(AutoLevels[12].Short,1)
AutoLevels[12].Short[0]:='craf';
AutoLevels[13].Name := 'fletching'
SetArrayLength(AutoLevels[13].Short,1)
AutoLevels[13].Short[0]:='flet';
AutoLevels[14].Name := 'slayer'
SetArrayLength(AutoLevels[14].Short,1)
AutoLevels[14].Short[0]:='slay';
AutoLevels[15].Name := 'mining'
SetArrayLength(AutoLevels[15].Short,1)
AutoLevels[15].Short[0]:='min';
AutoLevels[16].Name := 'smithing'
SetArrayLength(AutoLevels[16].Short,1)
AutoLevels[16].Short[0]:='smit';
AutoLevels[17].Name := 'fishing'
SetArrayLength(AutoLevels[17].Short,1)
AutoLevels[17].Short[0]:='fish';
AutoLevels[18].Name := 'cooking'
SetArrayLength(AutoLevels[18].Short,1)
AutoLevels[18].Short[0]:='ook';
AutoLevels[19].Name := 'firemaking'
SetArrayLength(AutoLevels[19].Short,2)
AutoLevels[19].Short[0]:='fm';
AutoLevels[19].Short[1]:='fire';
AutoLevels[20].Name := 'woodcutting'
SetArrayLength(AutoLevels[20].Short,2)
AutoLevels[20].Short[0]:='wc';
AutoLevels[20].Short[1]:='wood';
AutoLevels[21].Name := 'farming'
SetArrayLength(AutoLevels[21].Short,1)
AutoLevels[21].Short[0]:='farm';
end;
{*******************************************************************************
function InChatPost(Text : String) : Boolean;
By: WT-Fakawi
Description: Returns True if Text is in last Chat Message.
*******************************************************************************}
function InChatPost(Text: string): Boolean;
begin
Result := (Pos(Text, TheLine) <> 0);
end;
{*******************************************************************************
function NewRespond : boolean;
By: Masquerader
Description: Responds to keywords about skill levels. Adds to ChatLog.txt.
*******************************************************************************}
function RespondLevels:boolean;
var
i,j,TheLevel:integer;
begin
for i:=1 to 21 do
begin
for j:=0 to GetArrayLength(AutoLevels[i].Short)-1 do
begin
if(InChatPost(AutoLevels[i].Short[j]))then
begin
if(TimeFromMark(AutoLevels[i].Time)<1000*RespWait)then
begin
WriteLn('RESPONSE SUPPRESSED TO: '+AutoLevels[i].Name+' level')
WriteFileString(TheFile, TheTime +
' RESPONSE SUPPRESSED TO: '+AutoLevels[i].Name+' level' + Chr(13));
Exit;
end;
TheLevel:=Players[CurrentPlayer].Level[i];
if(TheLevel=0)then
begin
Players[CurrentPlayer].Level[i]:= GetSkillInfo(AutoLevels[i].Name,False);
TheLevel:=Players[CurrentPlayer].Level[i];
if(TheLevel=0)then
begin
WriteLn('ERROR: Could not get '+AutoLevels[i].Name+' level');
WriteFileString(TheFile, TheTime + ' ' +
'ERROR: Could not get '+AutoLevels[i].Name+' level'+ Chr(13));
Exit;
end;
end;
TypeSend(IntToStr(TheLevel))
Wait(500+Random(200));
WriteFileString(TheFile, TheTime + ' RESPONDED TO '+
AutoLevels[i].Name+' level : ' +IntToStr(TheLevel) + Chr(13));
WriteLn(TheTime + ' RESPONDED TO '+AutoLevels[i].Name+' level : ' +IntToStr(TheLevel));
MarkTime(AutoLevels[i].Time);
Result:=True;
Exit;
end;
end;
end;
end;
{*******************************************************************************
function Respond : boolean;
By: Masquerader
Description: Responds to keywords. Adds to ChatLog.txt.
*******************************************************************************}
function Respond: boolean;
var
i,j,z:integer;
TheResponse:string;
begin
if (not(UseAutoResponder)) then Exit;
SaveToChatLog;
if(OldLine=TheLine)then
Exit; //text hasnt changed
if(TheName=TheLine)then
Exit; //happens when no blue text or colon error
if (Pos(Players[CurrentPlayer].Nick, TheName) <> 0) then
Exit; //it is us talking
if(inchatpost('lv')or inchatpost('lev'))then
if(RespondLevels)then
begin
Result:=True;
Exit;
end;
for z := 0 to High(Names) do
if not Names[z] = TheName then
begin
AI_SetupNewPlayer(TheName);
SetArrayLength(Names, High(Names) + 1);
Names[z + 1] := TheName;
end;
AI_Respond;
for i:=0 to GetArrayLength(AutoText)-1 do
begin
for j:=0 to GetArrayLength(AutoText[i].Trigger)-1 do
begin
if(InChatPost(AutoText[i].Trigger[j]))then
begin
if(TimeFromMark(AutoText[i].Time)<1000*RespWait)then
begin
WriteLn('RESPONSE SUPPRESSED TO: '+AutoText[i].Name)
WriteFileString(TheFile, TheTime +
' RESPONSE SUPPRESSED TO: '+AutoText[i].Name+ Chr(13));
Exit;
end;
TheResponse:=AutoText[i].Reply[AutoText[i].Counter]
Wait(1000 + Random(2000));
TypeSend(TheResponse);
Wait(500+Random(200));
WriteFileString(TheFile, TheTime + ' RESPONDED TO '+
AutoText[i].Name+': ' +TheResponse + Chr(13));
WriteLn(TheTime + ' RESPONDED TO '+ AutoText[i].Name+': ' +TheResponse);
MarkTime(AutoText[i].Time)
AutoText[i].Counter:=AutoText[i].Counter+1;
if(AutoText[i].Counter>GetArrayLength(AutoText[i].Reply)-1)then
AutoText[i].Counter:=0;
Result:=True;
Exit;
end;
end;
end;
end;
{*******************************************************************************
procedure SetupNewSRLAutoResponder;
By: WT-Fakawi
Description: Sets up the auto responder
*******************************************************************************}
procedure SetupSRLAutoResponder;
begin
LoadNewWords;
end;