Autoresponders, randomtalkers?
I use pentti's chatboxrespond with arrays for things to search for and respond with. The responses are looped so no repetitive answers unless they say the trigger word 5+ times.
var
TheChatText: string;
x, y: Integer;
Gc, Nc, Qc, {Lc,} Bc, Mc, Fc: Byte;
GreetR, NoobR, QuestionR, FriendR, MacroR, {LevelR,} ByeR: Array of String;
Greeting, Noob, Question, Friend, Macro, {Level,} Bye: Array [0..4] of String;
procedure SetupRespond;
begin
Gc := Random(5);
Nc := Random(10);
Qc := Random(7);
Bc := Random(6);
//Lc := Random();
Mc := Random(8);
Fc := Random(5);
SetArrayLength(GreetR, 5);
SetArrayLength(NoobR, 10);
SetArrayLength(QuestionR, 7);
SetArrayLength(MacroR, 8);
SetArrayLength(FriendR, 6);
SetArrayLength(ByeR, 6);
Greeting[0] := 'hi';
Greeting[1] := 'ello';
Greeting[2] := 'hey';
Greeting[3] := 'sup';
Greeting[4] := 'wassup';
GreetR[0] := 'hello';
GreetR[1] := 'hey';
GreetR[2] := 'yeah';
GreetR[3] := 'ello';
GreetR[4] := 'sup?';
Noob[0] := 'choob';
Noob[1] := 'noob';
Noob[2] := 'nub';
Noob[3] := 'n00b';
Noob[4] := 'newb';
NoobR[0] := 'noob? lol';
NoobR[1] := 'who you calling a noob?';
NoobR[2] := 'no way';
NoobR[3] := '...';
NoobR[4] := 'whatever you say';
NoobR[5] := 'thanks?';
NoobR[6] := 'why you say that?';
NoobR[7] := 'huh?';
NoobR[8] := 'thx lol';
NoobR[9] := '?';
Question[0] := 'what';
Question[1] := 'why';
Question[2] := 'who?';
Question[3] := 'where';
Question[4] := 'when?';
QuestionR[0] := 'dunno';
QuestionR[1] := 'idk';
QuestionR[2] := 'don'#39't ask me';
QuestionR[3] := 'couldnt tell ya';
QuestionR[4] := 'huh';
QuestionR[5] := '...';
QuestionR[6] := 'don'#39't know';
Macro[0] := 'macro';
Macro[1] := 'bot';
Macro[2] := 'autoer';
MacroR[0] := 'who?';
MacroR[1] := 'nope';
MacroR[2] := 'annoying..';
MacroR[3] := 'no way';
MacroR[4] := 'can'#39't tell';
MacroR[5] := 'think so?';
MacroR[6] := 'idk';
MacroR[7] := '...';
Friend[0] := 'friend?';
Friend[1] := 'friends?';
Friend[2] := 'team?';
FriendR[0] := 'no ty';
FriendR[1] := 'no thanks';
FriendR[2] := 'nah';
FriendR[3] := 'don'#39't think so';
FriendR[4] := 'go away';
FriendR[5] := 'sorry no';
Bye[0] := 'bye';
Bye[1] := 'cya';
Bye[2] := 'gtg';
Bye[3] := 'm going';
Bye[4] := 'm leavin';
ByeR[0] := 'cya';
ByeR[1] := 'bye';
ByeR[2] := 'ok have fun';
ByeR[3] := 'cya later';
ByeR[4] := 'okay';
ByeR[5] := 'see ya';
end;
function ChatBoxRespond(TheText,FromText,SayText:string):Boolean;
var
GetName: string;
begin
if(TheText='')then Exit;
if(pos(lowerCase(FromText),LowerCase(Trim(TheText)))<>0)then
begin
GetName:=Trim(GetTextAtEx(20,412,45,SmallChars,False,False,0,2,0,40,True,tr_NormalChars));
if(pos(LowerCase(Players[Currentplayer].Name),LowerCase(GetName))<>0)then Exit;
Result:=True;
wait(500+random(2000))
TypeSend(SayText)
Writeln('| - - - - RESPOND - - - - -')
Writeln('|'+GetName+': '+FromText)
Writeln('|'+Players[CurrentPlayer].Name+': '+SayText)
writeln('| - - - - - - - - - - - - -')
Wait(500+random(1000))
end;
end;
procedure StandardAutoRespond;
var
i: byte;
begin
if(IsTextInAreaEx(40,412,130,412,x,y,':',0,smallchars,False,True,0,0,0))then //SRL: GetLastChatText
TheChatText:=Trim(GetTextAtEx(x+8,415,0,SmallChars,False,False,0,1,16711680,40,False,tr_allChars))
for i := 0 to 4 do
begin
if Gc > 4 then Gc := 0;
if Nc > 9 then Nc := 0;
if Qc > 6 then Qc := 0;
if Bc > 5 then Bc := 0;
//if Lc > then Lc := 0;
if Mc > 7 then Mc := 0;
if Fc > 5 then Fc := 0;
if ChatBoxRespond(TheChatText, Greeting[i], GreetR[Gc]) then Inc(Gc);
if ChatBoxRespond(TheChatText, Macro[i], MacroR[Mc]) then Inc(Mc);
if ChatBoxRespond(TheChatText, Bye[i], ByeR[Bc]) then Inc(Bc);
if ChatBoxRespond(TheChatText, Noob[i], NoobR[Nc]) then Inc(Nc);
if ChatBoxRespond(TheChatText, Friend[i], FriendR[Fc]) then Inc(Fc);
//ChatBoxRespond(TheChatText, Level[i], LevelR[Lc]);
Inc(i);
end;
end;
I saved it as autoresponderbeta in my core folder, included it in SRL.scar, and called SetupRespond in the SetupSRL procedure.
Searching for the 30 trigger words takes 16 miliseconds. :spot:
Feel free to use but please change the responses up a bit.