sub animalbirth {
$time=time;
#set two events, both calling say.
push (@{$do{$time+2}},{sub=>"say",args=>["The gods smile down from above and the words \"Hello child\" are heard. Welcoming the new $user{$client}{name} into the world","$user{$client}{room}"]});
push (@{$do{int($time+rand(15)+2)}},
{
sub=>"say",
args=>["A small puff of smoke rises from below the bench.","$user{$client}{room}"]
});
}
sub animalmain {
my $incoming=shift;
#example of AI, respond with a friendly gretting.
if (defined($user{$client}{dead})){
return;
}
if ($incoming=~/hello/i or $incoming=~/hey/i){
docommand("say hi, I'm $user{$client}{pre}$user{$client}{name}. Don't mind me I'm just wandering around.");
}
if ($incoming=~/\s*(\w*) begins to advance on you from/is){
print "being attacked, counterattacking $1";
docommand("say help I'm being attacked!");
docommand("eng $1");
return;
}
}
sub animalcounter{
local $client=shift;
docommand("swing");
}
sub docommand{
push (@{$ready{$client}}, shift);
}
1;