SRL Archive - NOTA

i wanna make something, :p SCAR, msl, php or javascript


Awkwardsaw

2010-01-09 17:04:32

im bored, nothing new in life, and i want to broaden(or practice) the stuff that i know :p

i'll make a script/ application thing for:
SCAR(no runescape scripts pl0x :))
msl(mirc)
php/javascript

any ideas? :p

NCDS

2010-01-09 17:51:01

IRC bots seem to be pretty good/common practice.

Awkwardsaw

2010-01-09 17:55:09

From: NCDS
IRC bots seem to be pretty good/common practice.


SCAR or php? :)

Blumblebee

2010-01-09 18:32:15

do it in SCAR :)

Awkwardsaw

2010-01-09 20:19:16

From: Blumblebee
do it in SCAR :)


mkay, :D

edit: finished, although sometimes it doesnt know you said any thing, which means it occasionally wont respond back

Sex

2010-01-09 20:25:16

So are you gonna post it :p?

Awkwardsaw

2010-01-09 20:29:56

From: Sex
So are you gonna post it :p?


i will later, still wanna do some st00f :)

Sex

2010-01-09 20:33:56

Well then let me see what you have on MSN :D. Go online.

Blumblebee

2010-01-09 22:07:20

May I see how you connect to the IRC server (or did you just use Yakmans Model)?

Awkwardsaw

2010-01-09 23:02:42

heres the little crap version that i have :)


program New;

const
nick = 'AkwardBot';
realname = 'dan';
port = 6667;
server = 'irc.swiftirc.net';
timeout = 9999;
Chan = '';


CRLF = #13#10; //dont touch, and thanks to Tootoot :D

procedure A_Debug(msg: string);
begin
writeln(msg);
alert(msg);
status(msg);
terminatescript;
end;

type
TMessage = record
mess, mess2, line, user, time : string;
end;

var
c, p: integer;
s, a: string;
TheMessage : TMessage;

function Connect: integer;
begin
p:= port;
repeat
result:= OpenConnection(server, p, timeout);
if result < 0 then inc(p);
until (port = 7000) or (c >= 0);
if result < 0 then exit;
writeln('Connection Open');
writeln(' ');
writeln('Server: ' + server);
writeln('Port: ' + inttostr(port));
writeln('Connection: ' + inttostr(c));
writeln(' ');
end;

procedure setup;
begin
if (not SendConnectionData(c, 'USER ' + nick + ' * * :' + realname + CRLF) and
SendConnectionData(c, 'NICK '+ nick + CRLF) and
SendConnectionData(c, 'JOIN ' + Chan + CRLF)) then
A_Debug('Joining messed up');
writeln('Nick Set:' + nick);
writeln('User Set: ' + realname);
writeln('Joined Channel: ' + chan);
writeln(' ');
wait(1000);
end;

Function Contain(Stringz, Strings : String) : Boolean;
Begin
Result := Pos(Stringz, Strings) <> 0;
End;

function parse(messge : string) : string;

begin
with themessage do
begin
user := between(':', '!~', messge);
mess := between('PRIVMSG', CRLF, messge);
result := user + ': ' + mess;
end;
end;

procedure ping(b : string);
begin
b := replace(b, 'PING', 'PONG');
if contain('PRIVMSG', b) then
exit;
SendConnectionData(c, b + CRLF);
end;

function GetFact: string;
var a: string;
begin
a:= getpage('http://www.randomfunfacts.com/');
result:= TrimEx(' ', between('<td bordercolor="#FFFFFF"><font face="Verdana" size="4"><strong><i>', '</i></strong></font>&nbsp;</td>', a));
end;

procedure respond(mess : string);
begin
if contain('PING', mess) then
ping(mess);
if contain('.fact', lowercase(parse(mess))) then
SendConnectionData(c, 'NOTICE ' + themessage.user + ' ' + getfact + CRLF);
end;

begin
if Connect < 0 then A_Debug('Connection Problems');
setup;
repeat
if not IsConnectionOpen(c) then A_Debug('Connection Closed');
ReadConnectionData(c, s);
if a <> s then
begin
if contain('PRIVMSG', s) then
writeln(parse(s));
respond(s);
a:= s;
end;
until isfkeydown(12) and isfkeydown(11);
end.