10-08-2009, 10:57 AM
Just place the scripts in the xChat directory and make sure there's the Perl extension ".pl".
Auto ReJoin when kicked:
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.
Rhythmbox NowPlaying script. Displays the currently playing song to the channel.
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.");
}
}