I'm trying to write a code that will send a message to all of the channels that I & a named person share. I also want to be able to use multiple names, and send a different message based upon the name, with the previous message being used as a default.
Here's the code so far
Code:
alias cmsg {
  var %cmsg.nicks = $iif($gettok($1-,1,44),$v1,$$input(Space or Comma separated,e,Matching nicks))
  %cmsg.nicks = $replace(%cmsg.nicks,$chr(44),$chr(32))
  var %a = 1, %b = $numtok(%cmsg.nicks,32)
  while %a <= %b {
    var %cmsg.msg = $iif($gettok($1-,2,44),$gettok($1-,2,44),$$input(Common message,e,,$iif(%cmsg.msg,$v1)))
    var %cmsg.nick = $gettok(%cmsg.nicks,%a,32), %c = 1, %d = $comchan(%cmsg.nick,0)
    while %c <= %d {
      var %cmsg.chans = $addtok(%cmsg.chans,$comchan(%cmsg.nick,%c),44)
      inc %c
    }
    .msg %cmsg.chans %cmsg.msg
  }
  inc %a
}

It appears the problem is around line 6, as it keeps prompting me for a new message, no matter how many (or few) nicks were specified. At the moment, I'm testing the code without specifying the nicks or message in the /cmsg command line.