SRL Archive - Senior Scripts and Snippets

RS >> IRC AutoResponder


Sir R. M8gic1an

2009-11-14 18:39:28

Well, an idea that just popped into my head, we could easily have a script that is playing runescape AND is connected to IRC (harry has done this much) and pastes the RS Chat, and you can command it answer certain things.


There are obviously dangers for this, but i can see quite some advantages. What do you guys think?

~RM

Dan Cardin

2009-11-14 18:42:50

are you kidding me?

Hobbit

2009-11-14 18:53:15

From: Dan Cardin
are you kidding me?


I don't think he is…

It could be useful

I don't think there would be a huge amount of danger to it though. Because really SCAR will be acting like a mediator between RS and IRC. So unless Jagex has some new fangled way of leeching into SCAR and detecting what its doing secretly though the client I don't think we'll have a problem.

I like the idea~!

Dan Cardin

2009-11-14 18:57:47

From: Hobbit
I don't think he is…

It could be useful

I don't think there would be a huge amount of danger to it though. Because really SCAR will be acting like a mediator between RS and IRC. So unless Jagex has some new fangled way of leeching into SCAR and detecting what its doing secretly though the client I don't think we'll have a problem.

I like the idea~!

http://villavu.com/forum/showthread.php?p=655677#post655677

i lol'd

Hobbit

2009-11-14 19:30:48

Lol… now i understand your first post

Cazax

2009-11-14 19:57:29

I could help, I've all the code necessary since Sparks(My IRC Bot) is written in SCAR. Contact me if you need the code or want me to help you :)

YoHoJo

2009-11-14 20:00:36

Yeah one of the old RSC scripts that solved the CAPTCHAs for fatigue used IRC! Something like sending the pic to people on an IRC channel, and people would type out the answer on IRC and script would type it out on RS! :D Idk though, are autoresponders really that good for antiban? Ive just never personally used one, but i do understand that talking makes you seem way more like a real human.

RAM

2009-11-14 20:06:45

I could not view link….?

Forgive my failing memory…but was was the program..Ghost Speak maybe ?…where you would get points or credits for talking for other people in RS ?…

I like the idea for IRC…I'm guessing a private channel for each script running ?…I haven't used RemoteControl.SCAR in awhile, but I'm guessing some of this work could be implemented into your new idea as well?

Wizzup?

2009-11-14 20:15:37

From: RAM
I could not view link….?

Forgive my failing memory…but was was the program..Ghost Speak maybe ?…where you would get points or credits for talking for other people in RS ?…

I like the idea for IRC…I'm guessing a private channel for each script running ?…I haven't used RemoteControl.SCAR in awhile, but I'm guessing some of this work could be implemented into your new idea as well?


Try adding www. in front of the link.

Dan Cardin

2009-11-14 23:10:16

From: RAM
I like the idea for IRC…I'm guessing a private channel for each script running ?…I haven't used RemoteControl.SCAR in awhile, but I'm guessing some of this work could be implemented into your new idea as well?
the beauty of it, is that the actual script doesnt matter! Sure you can have it actually look things up for stuff like if someone asks you your stats, but if not, then just about any other question is universal.

"what town are we in?" -> "shuttup silly young faced kid"
"are you a bot?" -> "ofc not you silly communist!"
"where is varrok" -> "gosh, i dunno!…maybe north of lumbridge you silly two faced linguist!"

etc, etc, etc. So all it really requires is people not being dinks in IRC. and then linking them in IRC. So you give each question a prefix in IRC, and to answer it, prefix + answer.

<MeowBot>1. How much does a piano cost?
<MeowBot>2. How old are you?
<ManFlardin>.1 $1333, duh?!
<GoogleDude>.2 13.

The Un-Named

2009-11-16 02:49:50

I made something like this years ago, what I did then was use Regex's tool to send messages(sendinterscarmessage iirc) to a small java app to relay that to irc, I believe I posted it here before if anyone wants to try to find it.

Cazax

2009-11-22 14:20:54

Ok, I have the include:
Type
BufferedReader = Record
Buffer : String;
Pos, Len: Integer;
UseSocket: Boolean;
End;

Var
Line : String;
Sock_Fd : Integer;
Reader : BufferedReader;
Questions, Answers : TStringArray;
Lines : TStringArray;

Const
BotChan = '#answerme';

Function GenerateName: String;
Var
I : Integer;
Begin
For I := 0 To 4 Do
Result := Result + Chr(RandomRange(97, 122));
Result := Result + IntToStr(Random(1000) + 1);
End;

Procedure DBug(S : String; T : Integer);
Begin
Case T Of
1: Writeln('- ' + S);
2: Writeln('=> ' + S);
3: Writeln('<= ' + S);
End;
End;

Procedure SendData(Buf : String);
Begin
DBug(Buf, 2);
SendConnectionData(Sock_Fd, Buf + #10 + #13);
end;

Procedure FillReaderBuffer(Var Reader : BufferedReader);
Var
Buf : String;
Begin
Try
ReadConnectionData(Sock_Fd, Buf);
Reader.Pos := 1;
Reader.Len:= Length(Buf);
Reader.Buffer:= Buf;
Except End;
End;

function Connect : Integer;
Var
Name : String;
begin
Result := OpenConnection('irc.rizon.net', 6669, 15000);
if(Result < 0)then
begin
DBug('Error connecting', 1);
Exit;
end;
ClearReport;
Name := GenerateName;
Dbug('Chosen name: ' + Name, 1);
SendData('USER ' + Name + ' 8 * :' + Name);
SendData('NICK ' + Name);
SendData('MODE ' + Name + ' +i');
SendData('MODE ' + Name + ' +E');
SendData('MODE ' + Name + ' +C');
SendData('MODE ' + Name + ' +I');
SendData('MODE ' + Name + ' +Q');
SendData('JOIN ' + BotChan);
end;

function ReadNextSegment(var reader: BufferedReader; c1, c2: char): string;
var
f: Integer;
begin
repeat
for f := reader.pos to reader.len do
if (reader.buffer[f] = c1) or (reader.buffer[f] = c2) then
begin
Result:= Copy(reader.buffer, reader.pos, f - reader.pos);
reader.pos:= f + 1;
Exit;
end;
if (reader.usesocket) then
FillReaderBuffer(reader)
else
Break;
until(False);
Result:= #0;
end;

function ReadNextLine(var reader: BufferedReader): string;
var
line: string;
c: char;
begin
try
line:= ReadNextSegment(reader, #10, #13);
c := reader.buffer[reader.pos-1];
except
Writeln('Error number ' + IntToStr(ExceptionPos) + ', procedure number ' + IntToStr(ExceptionProc) + ', Reason: ' + ExceptionToString(ExceptionType, ExceptionParam));
exit;
end;
if (c = #13) or (c = #10) then
reader.pos := reader.pos + 1;
Result := line;
end;

Function GetMsg(L : String): String;
Begin
Result := Right(L, (Length(L) - Pos('PRIVMSG ' + BotChan + ' :', L)) - Length('RIVMSG ' + BotChan + ' :'))
End;

Function GetCommand(L : String): String;
Var
S : String;
Begin
S := GetMsg(L);
If Pos('.', S) = 0 Then
Exit;
Result := Between('.', ' ', S);
If Result = '' Then
Result := Right(S, Length(S) - Pos('.', S));
End;

Function GetArgument(L : String): String;
Var
S, SS : String;
Begin
S := GetCommand(L);
SS := GetMsg(L);
If Pos(S, SS) + Length(S) = Length(SS) Then
Exit;
Result := Right(SS, (Length(SS) - Pos(S, SS)) - (Length(S) - 1));
Result := Right(Result, Length(Result) - 1);
End;

Procedure IRCWake;
Var
Msg, S : String;
Begin
Line := ReadNextLine(Reader);

DBug(Line, 3);
If Pos('PING', Line) > 0 Then
Begin
SendData('PONG :' + Right(Line, Length(Line) - Pos(':', Line)));
Exit;
End;

Msg := GetMsg(Line);
If Msg = '' Then
Exit;

If Msg[1] = '.' Then
If Pos(':', Line) > 0 Then
If Pos('PRIVMSG ' + BotChan, Line) > 0 Then
Begin
S := GetCommand(Line);

Case StrToIntDef(S, -2) Of
Low(Questions)..High(Questions): Answers[StrToInt(S)] := GetArgument(Line);
{More commands here}
End;

End;
End;

Function AutoRespond: Boolean;
Var
Temp : TStringArray;
Diffs : TIntegerArray;
H, I : Integer;
Begin
If Length(Answers) > 0 Then
Begin
Result := True;
For H := 0 To High(Answers) Do
Begin
If Answers[H] = '' Then
Continue;
TypeSend(Answers[H]);
End;
SetLength(Answers, 0);
SetLength(Questions, 0);
Exit;
End;
Temp := ChatBoxTextArray(ClBlue);
For I := 0 To 7 Do
If Lines[I] <> Temp[I] Then
Begin
SetLength(Diffs, Length(Diffs) + 1);
Diffs[High(Diffs)] := I;
End;
If Length(Diffs) = 0 Then
Exit;
SetLength(Questions, Length(Diffs));
SetLength(Answers, Length(Diffs));
H := High(Questions);
For I := 0 To H Do
SendData('PRIVMSG ' + BotChan + ' :' + IntToStr(H) + '.' + Questions[Diffs[H]]);
End;

Procedure SetupAutoResponder;
Begin
Sock_fd := Connect;
if(Sock_fd < 0)then
begin
DBug('Failed to connect', 1);
Exit;
end;
Reader.UseSocket := True;
FillReaderBuffer(reader);
Wait(2500);
SetTimeOut(30, 'IRCWake');
End;
But it has problems:
- Gives runtime error because of ChatBoxTextArray(don't know why).
- It doesn't have any question detector. It'll send to channel every new line it gets.

Also, Rizon KLined me after I tried a few times because they say I was 'hammering' their connections.