$bar
Platform: mIRC
Published Jun 27, 2007
Updated Jun 28, 2007
This identifier will calculate what percentage N is of C and display it in a coloured bar format, useful for rating scripts, it uses 20 characters, the majority are spaces but the middle shows the percentage, and if "text" exists, it will appear after the bar. If the percentage is more than 5 digits long it is displayed at the end of the bar after "text"
Usage: $bar(C,N,text)
alias bar {
set -u0 %i 1
set -u0 %p 5
while (( %i <= 20 )) {
if (( $calc( (100 / $$1) * $$2 ) >= %p )) set -u0 $+(%,c.,%i) 4,09
else set -u0 $+(%,c.,%i) 9,04
inc %i
inc %p 5
}
set %bar.per $round($calc( (100 / $$1) * $$2 ),0)
if (( $len(%bar.per) >= 6 )) { goto dig.more }
goto dig. $+ $len(%bar.per)
:dig.1
return $+(%c.1,$chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$chr(32),%c.9,$chr(32),%c.10,%bar.per,%c.11,%,%c.12,$chr(32),%c.13,$chr(32),%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null, $3 ))
:dig.2
return $+(%c.1,$chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$chr(32),%c.9,$left(%bar.per,1),%c.10,$right(%bar.per,1),%c.11,%,%c.12,$chr(32),%c.13,$chr(32),%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null, $3 ))
:dig.3
return $+(%c.1,$chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$chr(32),%c.9,$left(%bar.per,1),%c.10,$mid(%bar.per,2,1),%c.11,$right(%bar.per,1),%c.12,%,%c.13,$chr(32),%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null, $3 ))
:dig.4
return $+(%c.1, $chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$left(%bar.per,1),%c.9,$mid(%bar.per,2,1),%c.10,$mid(%bar.per,3,1),%c.11,$right(%bar.per,1),%c.12,%,%c.13,$chr(32),%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null, $3 ))
:dig.5
return $+(%c.1,$chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$left(%bar.per,1),%c.9,$mid(%bar.per,2,1),%c.10,$mid(%bar.per,3,1),%c.11,$mid(%bar.per,4,1),%c.12,$right(%bar.per,1),%c.13,%,%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null, $3 ))
:dig.more
return $+(%c.1,$chr(32),%c.2,$chr(32),%c.3,$chr(32),%c.4,$chr(32),%c.5,$chr(32),%c.6,$chr(32),%c.7,$chr(32),%c.8,$chr(32),%c.9,$chr(32),%c.10,$chr(32),%c.11,$chr(32),%c.12,$chr(32),%c.13,$chr(32),%c.14,$chr(32),%c.15,$chr(32),%c.16,$chr(32),%c.17,$chr(32),%c.18,$chr(32),%c.19,$chr(32),%c.20,$chr(32),,$iif($3 != $null,$3 $+ $chr(32)),$chr(32),%bar.per,%)
}