Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chiron (7362)

  (email not shown publicly)

Just so you know, I'm a 17 year old student residing in the UK, studying four subjects at A level, between partying (woot) and coursework im a half-assed perl hacker

Journal of chiron (7362)

Tuesday October 31, 2006
06:47 AM


[ #31456 ]
I was messing around with the ALICE chatbot software, when i learnt about AIML, this is a way for users to easily create there own chatbot personalitys and ten have them interpreted through the ALICE Engine, i then wondered if this could be implemented in perl, turns out somemone has done this already 'program v'. However i found it hard to pick out the ALICE Engine as it was heavily integrated with other stuff.

Thats when i found out about Net::AIML a simple module that integrates into pandorabots, a server hosting ALICE bots, basically it was just sending POST requests to the webpage, nothing to fancy. Anyway for a laugh i built it into a ircbot, to see who would be fooled into believing it was a real person, several people got strung along for a while although the majority soon recognised the hidden AI. Here's the code for it: *Sorry about the single letter variables, i couldn't be bothered to name them*

    use Net::IRC;
    use Net::AIML;
    use strict;
    use warnings;

    if (!@ARGV) {

        print "\nUSAGE: [SERVER] [NICK] [CHAN]\nTo talk to the bot simply /msg [NICK] [MESSAGE]\nOr in the channel [NICK], [MESSAGE]. Within your irc client\n";

    my $b = Net::AIML->new(botid => 'ba30d497ce360e23');
    my $i = new Net::IRC;
    my $c = $i->newconn("Server", $ARGV[0], "Nick", $ARGV[1]);
    my $x;

    $c->add_handler(376, \&o);
    $c->add_handler('msg', \&m);
    $c->add_handler('public', \&m);

    sub o {
        (my $s = shift)->join($ARGV[2]);
        $x = 1;

    sub m {
        if ($x == 1) {

            my ($s, $e) = @_;
            if ($e->{type} =~ /public/ && $e->{args}[0] =~ /^($ARGV[1]), /i or $e->{type} =~ /msg/) {

                my $d = ($e->{type} =~ /public/) ? $e->{to}[0] : $e->{nick};
                my $r = $e->{args}[0];
                $r =~ s/^($ARGV[1]), //i;
                    my $t = $b->tell($r)."\n";

                $t =~ s/^Alice ://i;
                $t =~ s/<\/?.+?>//g;
                $s->privmsg($d, $t);

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.