You don't need to loop for the N of <nick> on <chan> like in the getnickidle-alias to get $nick($chan,N).idle. You can do without that loop (and thus without that alias) by using $nick($chan,$nick).idle right away smile
Regarding the kick issue, you put "($nick($chan,$1).idle > %idletime) " which should be ($nick($chan,$2).idle > %idletime)

Below's but a suggestion:
- added the 60s %limit local variable on top, just in case you don't set some global variable elsewhere. If you want to use "%idletime", just rename %limit to %idletime
- merged some conditions
- moved the kick-command (it will now either msg or kick)
- put #$3 in place of $3 in case of an omitted channel prefix
- added the case #$3 == $chan
Code:
on *:TEXT:!idle*:#uno: {
  var %limit = 60
  if (!$2) { msg $chan you must supply a nickname and optionally a channel. }
  else {
    if ((!$3) || (#$3 == $chan)) {
      if ($2 ison $chan) {
        var %idle = $nick($chan,$2).idle
        if (($me isop $chan) && ($2 != $me) && (%idle > %limit)) { kick $chan $2 You have been idle too long! ( $+ $duration(%idle) - limit is $duration(%limit) $+ ) }
        else { msg $chan $2 has been idle on $chan for $duration(%idle) $+ . }
      }
      else { msg $chan $2 is not on $chan $+ . }
    }
    elseif ($me ison #$3) {
      if ($2 ison #$3) { msg $chan $2 has been idle on #$3 for $duration($nick(#$3,$2).idle) $+ . }
      else { msg $chan $2 is not on #$3 $+ . }
    }
    else { msg $chan I am not on #$3 $+ . }
  }
}


P.S. Try to wrap pasted code with the [code][/code] tags wink