Tip of the Day: Make a Perl Script for XChat to Part/Rejoin a Channel Similar with mIRC's /HOP

    For those coming from the Windows OS which are probably used to mIRC, here is a short Perl script for XChat which will do the same thing as /HOP in mIRC, and that is, it will part and rejoin a channel immediately.

    By default, XChat provides the /HOP command, which is used to give chanhalf-op to the provided nickname. We will not replace this command as it still may be useful on some networks, instead we will use a new command, say /PJ (or any other you like).

    The script
    Here's how the script looks like:

    Xchat::register ("PJ", "0.1.0", "Part/Join");

    Xchat::hook_command ("PJ", cmd_pj);

    Xchat::command ("ECHO PART/JOIN script loaded. Use it typing /PJ.");

    sub cmd_pj
    {
    $chan = Xchat::get_info ("channel");
    Xchat::command ("PART $chan");
    Xchat::command ("JOIN $chan");
    return Xchat::EAT_ALL;
    }
    What does it do?
    Basically, the first command will tell XChat the information about the script (name, version number, description). The second one will declare the command /PJ and the subroutine to use when it's triggered, cmd_pj. The body under sub cmd_pj contains what the command will actually do, and that's to get the name of the current channel, part it and rejoin.

    Save the script under any name, say pj.pl, and put it under your ~/.xchat2/ directory, where ~ is your home directory. The script will be automatically loaded each time XChat starts.Source URL: http://ashesgarrett.blogspot.com/2009/01/tip-of-day-make-perl-script-for-xchat_12.html
    Visit ashes garrett for Daily Updated Hairstyles Collection

Blog Archive