# documentation follows __END__ use strict; # always! use warnings; my $NAME = 'Multiple Commands'; my $VERSION = '003'; my $COMMAND = 'MULTI'; my $USAGE = "Usage: $COMMAND [separator [...]]"; Xchat::register( $NAME, $VERSION, "Execute multiple commands in sequence" ); Xchat::hook_command( $COMMAND, \&multi, {help_text=>$USAGE} ); Xchat::print( "\02$NAME $VERSION\02 by b0at (use /$COMMAND)" ); sub multi { my $sep = $_[0][1]; # first word is the separator my $cmd = $_[1][2]; # rest of the arguments taken as one string ( not defined $sep or not defined $cmd ) ? Xchat::print($USAGE) # incorrect args, show help text : Xchat::command($_) foreach( split /\s+\Q$sep\E\s+/, $cmd ); return Xchat::EAT_ALL; # don't allow xchat to pass this along } 1; __END__ author: b0at license: public domain examples: /multi | cmode +m | say NO YOU STFU! | timer 7 cmode -m /multi => say Well, would you look at the time? => join 0 => quit some other ways to execute multiple commands: (http://www.xchat.org/faq/index.html#q214) - /load -e /path/to/file - same-named user commands (Settings -> Lists -> User Commands)