dynamic length of the bar, like mine
bar { var %e = $2, %r = $calc($3 / %e), %x = $round($calc($1 / %r),0) | return 9,9 $+ $str(X,%x) $+ $iif($calc(%e - %x) > 0,$+(,4,$chr(44),4,$str(X,$calc(%e - %x)))) }
ex $bar(30,100,99) does the same thing as yours, but the length of the hp bar is 100 characters.