Try this:
alias checkchan {
var %c = 1, %t = $scon(0)
while (%c <= %t) {
scon %c
if ($network == network1) {
echo -a NETWORK: $network
echo -a I'm $iif($me !ison #chan1,NOT) on $v2
echo -a I'm $iif($me !ison #chan2,NOT) on $v2
}
elseif ($network == network2) {
echo -a NETWORK: $network
echo -a I'm $iif($me !ison #chan3,NOT) on $v2
echo -a I'm $iif($me !ison #chan4,NOT) on $v2
}
inc %c
}
}
This will not display "not on" messages for networks that you are not connected to.
* Note that I know there is some security issue with using scon/scid, but I'm not real clear on what it is. Hopefully someone who understands it can decide if this is safe.

EDIT:
Here's another option that would work if you have many networks and channels:
alias checkchan {
var %network1 = #chan1 #chan2
var %network2 = #chan3 #chan4
var %c = 1, %t = $scon(0)
while (%c <= %t) {
scon %c
if ($($+(%,$network),2)) {
echo -a NETWORK: $network
var %cc = 1, %ct = $numtok($($+(%,$network),2),32)
while (%cc <= %ct) {
var %chan = $gettok($($+(%,$network),2),%cc,32)
echo -a I'm $iif($me !ison %chan,NOT) on $v2
inc %cc
}
}
inc %c
}
}
For this one, be sure to change the network variable names to be exactly the same as what $network returns. For example:
var %undernet = #chan1 #chan2
var %efnet = #chan3 #chan4