Yes i was wrong, use this code:

Code:
alias f2 { markasread IRC-NETWORK-HERE #CHANNEL-NAME-HERE }
alias markasread {
  if (!$1) { echo 4 -a Error: Please specify a network! | return }
  if (!$2) { echo 4 -a Error: Please specify a channel! | return }
  var %t = $scon(0)
  while (%t) {
    if ($scon(%t).network == $1) { var %id = $scon(%t).cid }
    dec %t
  }
  if (!%id) { return }
  scid %id
  if ($window($2)) { window -g0 $qt($2) }
}


If you want to find the network you can use : //echo -a $network