Code:
alias -l findNetworkCid {
  var %a 1
  var %connections $scon(0)
  while (%a <= %connections) {
    if ($scon(%a).network == $1) { scon %a | return $cid }
    inc %a
  }
}

on 1:text:*:#: {
  var %networkList network1 network1 network2 network3 network3 network3
  var %channelList #chan1 #chan2 #chan3 #chan4 #chan5 #chan6
  var %a 1
  var %channels $numtok(%channelList,32)
  var %channel $chan
  var %network $network
  while (%a <= %channels) {
    if (($gettok(%channelList,%a,32) == %channel) && ($gettok(%networkList,%a,32) == %network) {
      var %isOnList $true
      break
    }
    inc %a
  }
  if (%isOnList != $true) { halt }
  var %a 1
  while (%a <= %channels) {
    if (($gettok(%channelList,%a,32) != %channel) || ($gettok(%networkList,%a,32) != %network) {
      scid $findNetworkCid($gettok(%networkList,%a,32))
      msg $gettok(%channelList,%a,32) %network $+(%chan,: <,$nick,> $1-)
    }
    inc %a
  }
}


I haven't tested this yet, but I use a similar method for remembering which channel goes with which network on another script. Keep in mind that with this method, you need to make sure that the channels stay in order with the networks. That is, the 3rd channel needs to correspond with the 3rd listed network, and you may want to list the same network more than once if you have more than one channel on the same network you want this working in.

Edit: I decided to clarify a bit. In this particular example, network1 is listed twice, then network 2 is listed once, then network3 is listed 3 times. Since network1 is the first and second item in the network list, the first 2 channels will pair with that network. The third channel pairs with the third network (network2), and the 4th through 6th channels will pair with the 4th through 6th network items (all of them are network3).

Last edited by KageNoOni; 19/08/10 01:21 AM.