Sorry, missed a ). I changed it to work without the ?. I did that because that's how your example was.

Code:
on *:start: {
  hmake AwayTable 50
}

on *:text:!afk*:#yourchannel: {
  var %time = $ctime
  if (!$hget(AwayTable)) { hmake AwayTable 50 }
  hadd AwayTable $nick $iif($2,$2-,Unknown) %time
  msg $chan $nick is away @ $+ $time(%time)
}

on *:text:!back:#yourchannel: {
  if ($hget(AwayTable,$nick)) {
    msg $chan $nick is back from $gettok($v1,1- $calc($gettok($v1,0,32) - 1)) $+ .  $nick was gone for $duration($calc($ctime - $gettok($v1,$gettok($v1,0,32),32))) $+ .
    hdel AwayTable $nick
  }
  else msg $chan You're not away.
}

on *:text:*:#yourchannel: {
  if ($hget(AwayTable,$remove($strip($1),?)) && !$2) {
    var %data = $hget(AwayTable,$remove($strip($1),?))
    msg $chan $left($1,-1) is away $chr(40) $+ $gettok(%data,1- $calc($gettok(%data,0,32) -1),32) $+ $chr(41) since $time($gettok(%data,$gettok(%data,0,32),32)) $+ .
  }
}

on *:part:#yourchannel: {
  if ($hget(AwayTable,$nick)) {
    hdel AwayTable $nick
  }
}

on *:quit: {
  if ($hget(AwayTable,$nick)) {
    hdel AwayTable $nick
  }
}


It now triggers the away message for:

nick
nick?

and also works if colors are used. It only displays if only the nick is on the line.