I'd suggest you didnt, but if that's what you really want, try this:
Code:
alias netcheck { 
  if ($1) { 
    scid -at1 whois $1 
    set %netcheck.total $scon(0) 
    set %netcheck.whois $1
  } 
  else { 
    echo -a ** Please specify the nick to scan for
  } 
}
raw 312:*: {
  if (%netcheck.whois) { 
    echo -a %netcheck.whois is connected to $network
 [color:red]   msg $2 blah blah blah[/color] 
    if ($scid == %netcheck.total) {
      unset %netcheck.total | unset %netcheck.whois 
    }
  }
}


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net