Does $2 work from raws?
Code:
raw 366:*:{
  var %i = 1
  while $nick($2,%i) { echo $2 $v1 | inc %i }
}