Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some simple Perl script snipets for xChat by B22stard
#1
Just place the scripts in the xChat directory and make sure there's the Perl extension ".pl".

Auto ReJoin when kicked:
Code:
#!/usr/bin/perl

my $version = "0.1";
Xchat::register("ReJoin", $version, "Re-join when kicked", "");
Xchat::print("Loaded: Perl AutoReJoin script by B22stard");
Xchat::hook_print("You Kicked", "kicked");

sub kicked {
  my $channel = Xchat::get_info( "channel");
  Xchat::command("j $channel");
  return Xchat::EAT_NONE;
}

Hop script. I wrote this script because there's not "/hop" command for xChat like there is with mIRC. It leaves and rejoins the channel when the command is given.
Code:
#!/usr/bin/perl

my $version = "0.1";
Xchat::register("HopScript", $version, "Leave and Rejoin the channel", "");
Xchat::print('Loaded: Perl Hop script by B22stard. Type "/rejoin" to leave and rejoin the channel.');
Xchat::hook_command("rejoin","rejoin");

sub rejoin {
  my $channel = Xchat::get_info( "channel");
  Xchat::command("part $channel hopping");
  Xchat::command("join $channel");
}

Rhythmbox NowPlaying script. Displays the currently playing song to the channel.
Code:
#!/usr/bin/perl

my $version = "0.3";
Xchat::register("NowPlaying", $version, "Displays currently playing song from Rhythmbox", "");
Xchat::hook_command("np", "nowPlaying");
Xchat::print('Loaded: Perl NowPlaying script by B22stard. Type "/np".');

sub nowPlaying {
    if (`ps -C rhythmbox` =~ /rhythmbox/) {
    $title = `rhythmbox-client --print-playing-format %st`;
    if (length $title > 1) {
        $title = `rhythmbox-client --print-playing-format %st\\ -\\ %tt`;
    } else {
        $title = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
    }
    chop $title;
    Xchat::command("me is listening to: " . $title);
    } else {
    Xchat::print("Rhythmbox is not running.");
    }
}
Reply
#2
Not bad, thanks for the share...keep em comming
Reply
#3
Awesome, I like the music box one!

Good work!
Reply
#4
@ B22stard

These are good.Post Like this to get +rep
[Image: 2d75599e9a.png]:superman:
Reply
#5
thanks,would rep you but, i need 100 posts
Reply
#6
worth getting, nice!
CHINAMAN
Quote:i like to make myself belie
[Image: 2n7ehx4.jpg]
[Image: save_banner.asp?file=HWHERMJMMH.jpg]
Reply
#7
Very good.
1. You can turn autojoin oni (/set)
2. You can just alias /cycle to /hop ;)
[Completely Honest. Seriously.]

Protip: Anonymous Reputation Points are for Pussies
Reply
#8
Sweet Rythmbox, script......Hmmm maybe I should switch permanently to rythmbox
Reply
#9
Oh that's a stupid idea bsdpunk.
[Completely Honest. Seriously.]

Protip: Anonymous Reputation Points are for Pussies
Reply
#10
Heh, took me a little bit to get the aac files to work, But at home I'm completely switched over Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compile Error in Perl liveproject101 0 1,154 04-12-2013, 03:08 AM
Last Post: liveproject101
  [Perl] IRC Bot wchar_t 26 12,860 08-20-2012, 01:40 PM
Last Post: Trump
  Perl Ebook ven0m 2 1,625 05-04-2012, 08:14 AM
Last Post: ven0m
  Help with a program written in perl Rodman42866 1 1,530 03-09-2012, 03:16 AM
Last Post: AceInfinity
  HTML perl script AceInfinity 5 2,408 12-03-2011, 11:35 PM
Last Post: Closed Account

Forum Jump:


Users browsing this thread: 1 Guest(s)