# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1274718439 18000 # Node ID c1bbeff37875b76c577ac0725a3e9f087453066d # Parent 037012a17457bd802847cde3affe1b0e7040895a Bugfixes to last commit diff --git a/teh-lol.pl b/teh-lol.pl --- a/teh-lol.pl +++ b/teh-lol.pl @@ -20,12 +20,10 @@ Xchat::hook_print('Channel Message', \&check_lol); Xchat::hook_print('Your Message', \&update_tstamp); -use Time::HiRes; - my %timestamp; sub update_tstamp{ - if( $_[0][1] =~ /\b(lo+l)\b/i ){ + if( $_[0][1] eq "lol" ){ my $chan = Xchat::get_info("channel"); $timestamp{$chan} = time; } @@ -62,15 +60,20 @@ #Delay the response a little, for maximum annoyance. #( theoros's algorithm from #not-math ) - my $delay = 2.8; + my $delay = 1.8; if (length($relol) > 3){ $delay += ((length $relol) - 3 + rand(5)) * 0.069; } - #Convert to microseconds. - $delay *= 1e6; + #Convert to milliseconds. + $delay *= 1e3; - Xchat::hook_timer($delay, sub { Xchat::command("say $relol"); }); + Xchat::hook_timer($delay, + sub { + Xchat::command("say $relol"); + return Xchat::REMOVE; + } + ); } $timestamp{$chan} = time; }