#!/usr/bin/perl
use warnings;
use strict;
# Just edit which channels you want it to work on and which ones not to.
# Read the script is recommended, edit or add phrases to random strings if
# you want. I dont really care. Its a useless script anyways :p -- Jeff W. aka vizsla or towlie
my $script = "\cC13ASL";
my $version = "2.0";
my $desc = "ASL responder";
Xchat::register($script,$version,$desc, \&unload);
#text events to do callbacks on and what messages to look for
my $hook = Xchat::hook_print("Channel Message", \&asl_sub);
# list of phrases to be later randomized :D
my @tooyoung;
my @teens;
my @twenties;
my @fifties;
# counts when something is like an asl is captured
my $counter;
# Evaluates Text Event "Channel Message".
sub asl_sub {
#current room name
my $channel = Xchat::get_info("channel");
#If a channel is either #help or #trivia, then it wont go any further.
if ($channel =~ /^#(?:help|trivia)$/i) {
}
#then gets text from desired rooms
my $text = $_[0][1];
Xchat::strip_code($text);
my $nick = $_[0][0];
Xchat::strip_code($nick);
# asl regex, 129 is highest age, 2 digits, or 1 digit then any spaces or / or - or , sex mfmalefemale, and atleast 15 letters
# not sure, I just wrote it this way for boredom... I forgot already what half of it means xD
if ( $text =~ /([1]{1}[0-2]{1}[0-9]{1}|[1-9]{1}[0-9]{1}|[1-9]{1})(?:\s+|\/|\-|\,)(m|f|male|female)(?:\s+|\/|\-|\,)(?:[A-Za-z]{2,15})/i ) {
#regex callbacks assigning
my $age = $1;
my $sex = $2;
if ( $age < 13 && $channel !~ /^#lobby/i ) {
my $said = &randomtooyoung(); #reference to sub
Xchat::command("timer .4 msg $channel $nick $said");
&hook_timer(10000);
}
elsif ( $age > 12 && $age < 20 ) {
my $said = &randomteen();
Xchat::command("timer .4 msg $channel $nick you are $age $said");
&hook_timer(10000);
}
elsif ( $age > 19 && $age < 30 && $sex =~/^f/i ) {
my $said = &randomtwenty();
Xchat::command("timer .4 msg $channel $nick omg $age $said");
&hook_timer(10000);
}
elsif ( $age > 29 && $age < 40 ) {
Xchat::command("timer .4 msg $channel $nick you are $age years old :o");
&hook_timer(10000);
}
elsif ( $age > 39 && $age < 50 ) {
Xchat::command("timer .4 msg $channel $nick NO! dont have your midlife crisis :P , $age isn't that old, maybe.");
&hook_timer(10000);
}
elsif ( $age > 49 && $age < 65 ) {
my $said = &randomfifty();
Xchat::command("timer .4 msg $channel $nick whoa your are $age years old o: $said");
&hook_timer(10000);
}
elsif ($age > 64 && $age < 100 && $sex =~ /^f/i ) {
Xchat::command("timer .4 msg $channel $nick you are officially old dont forget your medication grandma");
&hook_timer(10000);
}
elsif ( $age > 64 && $age < 100 && $sex =~ /^m/i ) {
Xchat::command("timer .4 msg $channel $nick you are officially old dont forget your medication grandpa");
&hook_timer(10000);
}
elsif ( $age > 99 ) {
Xchat::command("timer .4 msg $channel $nick LIES! your not $age years old pfft");
&hook_timer(10000);
}
}
# These will only work in the room specified below #teen-chat or #lizard
elsif ( $channel =~ /^#(?:teen\-chat|lizard)$/i ) {
# I dont know if it works, it looks for CAPS
if ( $text =~ /(?:[A-Z]{10,14}|[A-Z]{2,} [A-Z]{8,15})/ ) {
Xchat::command("timer .4 bs say $channel \cB$nick\cO: Easy on the caps please...");
&hook_timer(4000);
}
# If a noobs says "pm me" or something overly used...
elsif ( $text =~ /\bpm (?:me|you|u)\b/i ) {
Xchat::command("timer .4 bs say $channel $nick no we do not want to pm you :|");
&hook_timer(10000);
}
elsif (lc( $text eq "what is love" )) {
Xchat::command("timer .3 msg $channel Baby Don't Hurt Me, Don't Hurt Me, No More...");
&hook_timer(5000);
}
elsif (lc( $text eq "kick me") ) {
Xchat::command("cs kick $channel $nick Requested.");
&hook_timer(10000);
}
}
}
# routine to make a timer to help stop of abuse of script
sub hook_timer {
$counter++;
Xchat::unhook($hook);
my ($milliseconds) = shift( @_ );
Xchat::hook_timer($milliseconds,
sub {
$hook = Xchat::hook_print("Channel Message", \&asl_sub);
}
);
if ($counter > 10 ) {
Xchat::command("unload asl.pl");
}
}
# these subs pick a random scalar of a global array ( lines 18-29)
sub randomteen {
@teens = ( "omg hawt", "get away emo n00b", "teenagers pfft >.> ...", "don't go emo on me D: \\wrists",
"go be a kid D:", "kids these days... >.<", "your my new pet", "meow", "www.freejavachat.com" );
}
sub randomtwenty {
@twenties = ( "go to college", "go party", "you're in the prime of your life", "hawt", "will you mary me?",
"why give your asl?", "get a job!" );
}
sub randomfifty {
@fifties = ( "don't forget your colonoscopy! ;o", "are you my dad?", "adopt me", "I see a bald spot",
"just about over the hill :P" );
}
sub randomtooyoung {
@tooyoung = ( "goo goo gaga", "its recess! go outside and play and come back when you're of age",
"pedobear wants you", "you are too young for here", "I'm telling your mom!",
"hellokitty.com is better for you", "I like barbies too", "nap time, you're too young" );
}
# prints when script is unloaded :O
sub unload {
Xchat
::print($script . " " . $version . " unloaded..");
}