Here\'s what I came up now and includes the update that you did. I tested it & seems to works fine. This is just to give you an idea on how to shorten it. =)
alias bar {
var %l = 20, %a = $round($calc((100 / $$1) * $$2 ),0), %o = $round($calc(%l * (%a / 100)),0), %d = $round($calc(%l / 2),0), %b1 = $str($chr(160),%l)
var %p = $round($calc(($len(%a) + 1) / 2),0), %p1 = $calc(%d - %p), %p2 = $calc(%l - %p1 - $len(%a $+ %)), %b2 = $mid(%b1,1,%p1) $+ %a $+ % $+ $right(%b1,%p2)
return 08,12 $+ $iif($len(%a) > 5,%b1 $+ %a $+ %,$left(%b2,%o) $+ 12 $+ $chr(44) $+ 08 $+ $right(%b2,$calc(%l - %o)) $+ ) $3-
}