Support Forums

Full Version: Some simple Perl script snipets for xChat by B22stard
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.");
    }
}
Not bad, thanks for the share...keep em comming
Awesome, I like the music box one!

Good work!
@ B22stard

These are good.Post Like this to get +rep
thanks,would rep you but, i need 100 posts
worth getting, nice!
Very good.
1. You can turn autojoin oni (/set)
2. You can just alias /cycle to /hop ;)
Sweet Rythmbox, script......Hmmm maybe I should switch permanently to rythmbox
Oh that's a stupid idea bsdpunk.
Heh, took me a little bit to get the aac files to work, But at home I'm completely switched over Smile
Pages: 1 2