You can combine them and share one alias like so:
Code:
on ^*:quit: qn $nick $1-
on ^*:nick: qn $newnick
alias -l qn {
  var %chan = #test
  if ($1 !ison %chan) { return }
  var %addr = ( $+ $address $+ ), %msg = ( $+ $2- $+ )
  var %i = 1, %n = $comchan($1,0)
  while (%i <= %n) {
    if ($comchan($1,%i) != %chan) {
      var %v1 = $v1
      echo -i2tc %v1 * $nick(%v1,$1).pnick %addr $iif($event == quit,Quit %msg,Nick is now known as $newnick)
    }
    else {
      echo -i2tc %v1 * $iif($event == quit,custom message line for quit,custom message line for Nick)
    }
    inc %i
  }
  haltdef
}
I haven't tested this but should work as per your wish.