Mercurial > hg > scripts
changeset 5:8f209cd0a7b6
Delay according to theoros's algorithm
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Wed, 12 Aug 2009 19:15:02 -0500 |
parents | 64eeadb27362 |
children | 6999ba7bf22b |
files | teh-lol.pl |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/teh-lol.pl +++ b/teh-lol.pl @@ -17,6 +17,8 @@ Xchat::hook_print('Channel Message', \&check_lol); +use Time::HiRes; + my %timestamp; sub check_lol { @@ -45,7 +47,13 @@ ) { #Delay the response a little, for maximum annoyance. - sleep (rand(3)+2); + #( theoros's algorithm from #not-math ) + my $delay = 0.8; + if (length($relol) > 3){ + $delay += ((length $relol) - 3 + rand(5)) * 0.069; + } + + Time::HiRes::usleep($delay); Xchat::command("say $relol"); }