Couple of things I see at a quick look

There's no reason for "var %nick = $2", just use $2.

Why loop channel/query/chat's twice?

Also just declare %rchans blank and add chans as needed.



Code:
  var %i = 1, %cidles, %rchans
  if ($query($2)) { %cidles = $+(Query[,$dur($query($2).idle,%PRECISION),]) }
  if ($chat($2)) { %cidles = %cidles $+(Chat[,$dur($chat($2).idle,%PRECISION),]) }
  WHILE $gettok(%chans,%i,32) {
    var %pchan = $v1, %chan = $regsubex(%pchan,/^[^ $chantypes ]*/x,)
    if ($nick(%chan,$2).idle isnum) { %cidles = %cidles $+(%pchan,[,$dur($v1,%PRECISION),]) }
    else %rchans = %rchans %pchan
    inc %i
  }


Also
Code:
alias dur return $regsubex($gettok($duration($1),1- $2,32),/[kayrinec ]s?/g,)


Last edited by Deega; 18/08/13 11:05 PM.