Advertisement
swarley

Fabulous.p | Fabulous Xchat script =]

Sep 5th, 2011
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.64 KB | None | 0 0
  1. use warnings;
  2. use strict;
  3. use utf8;
  4. use Acme::LOLCAT;
  5. use Xchat ':all';
  6.  
  7.  
  8. Xchat::hook_command('fabulous', 'fabulous');
  9. Xchat::hook_command('fabface','fabface');
  10. Xchat::hook_command('bubble','bubble');
  11. Xchat::hook_command('ascii2fabulous','fabulous_wild');
  12. Xchat::hook_command('fantabulous','fantabulous');
  13. Xchat::hook_command('fantabface', 'fantabulousface');
  14. Xchat::hook_command('lolcat','lolcat');
  15. Xchat::hook_command('fabucat','fabucat');
  16. Xchat::hook_command('rainbowfabcat', 'rainbowfabcat');
  17. Xchat::hook_command('fabulous_type', 'set_type');
  18.  
  19. my $text_type   = 'fabulous';
  20. my @colors = qw[05 04 07 08 09 03 11 10 12 02 06 13 15 14];
  21. my $a      = 97;
  22. my %start  = (
  23.     fabulous => 65313,
  24.     bubble   => 9424,
  25.     sub_bold => 63329,
  26.     super    => 7468,
  27.     douche   => 120094
  28. );
  29.  
  30. sub get_letter {
  31.     my ($type, $letter) = (shift, shift);
  32.     my $ord = (ord lc $letter) - $a;
  33.     return $letter if $ord < 0 || $ord > 25;
  34.     my $newletter = $start{$type} + $ord;
  35.     chr $newletter
  36. }
  37.  
  38. sub ascii2fabulous {
  39.     my $type    = shift;
  40.     my @letters = split //, shift;
  41.     my $str     = q();
  42.     foreach my $letter (@letters) {
  43.         $str .= get_letter($type, $letter);
  44.     }
  45.     $str
  46. }
  47.  
  48. sub fabulous_wild {
  49.     my $type = (split(/\s/, $_[1][1], 2))[0];
  50.     my $msg  = (split(/\s/, $_[1][1], 2))[1];
  51.     Xchat::command('SAY '.ascii2fabulous($type, $msg));
  52. }
  53.  
  54. sub fabface {
  55.     Xchat::command('SAY \( *¯∇¯)ノ ☆'.ascii2fabulous('fabulous', $_[1][1]).'~☆');
  56. }
  57.  
  58. sub bubble {
  59.     Xchat::command('SAY '.ascii2fabulous('bubble', $_[1][1]));
  60. }
  61.  
  62. sub fabulous {
  63.     Xchat::command('SAY '.ascii2fabulous('fabulous',$_[1][1]));
  64. }
  65.  
  66. sub fantabulous {
  67.     Xchat::command('SAY '.str2rainbow(ascii2fabulous($text_type,$_[1][1])));
  68. }
  69.  
  70. sub fantabulousface {
  71.     Xchat::command('SAY '.str2rainbow('\( *¯∇¯)ノ ☆').str2rainbow(ascii2fabulous($text_type,$_[1][1])).'~☆');
  72. }
  73.  
  74. sub str2rainbow {
  75.     my ($msg, $str) = (shift, '');
  76.     foreach my $l (split //, $msg) {
  77.         if (uc $l eq $l) {
  78.             $l = "\2$l\2"
  79.         }
  80.         $l = "\x03".($colors[rand @colors]).$l;
  81.         $str .= $l
  82.     }
  83.     return $str
  84. }
  85.  
  86. sub lolcat {
  87.     Xchat::command("SAY ".translate($_[1][1]));
  88. }
  89.  
  90. sub set_type {
  91.     if (exists $start{$_[1][1]}) {
  92.         $text_type = $_[1][1];
  93.         Xchat::print("text_type: $text_type");
  94.     }
  95.     else {
  96.         Xchat::print("No such text_type");
  97.     }
  98. }
  99.  
  100. sub fabucat {
  101.     Xchat::command("SAY ".ascii2fabulous($text_type,translate($_[1][1])));
  102. }
  103.  
  104. sub rainbowfabcat {
  105.     Xchat::command('SAY '.ascii2fabulous($text_type,str2rainbow(translate($_[1][1]))));
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement