42b
@verb #4457:"to_bar" this none this rxdo #4457
@program #4457:"to_bar" this none this
"Copied from Jorlando (#5772):to_bar Sep 18 16:39:56 2000"
{of, what, ?words = ""} = args
if (of == what && of != 0)
perc = 100
elseif (of != 0)
perc = `tostr(tofloat(of) / tofloat(what)) ! E_DIV => 0'
perc = length(perc) == 3 ? toint(perc[3] + "0") | toint(perc[3..4])
else
perc = 0
endif
cname = perc == 0 ? "white" | (perc > 0 && perc <= 33 ? "red" | (perc > 33 && perc <= 66 ? "yellow" | "green"))
colors = $gu:lmg({"ff0000", "ff0000", "ffff00", "ffff00", "00ff00", "00ff00"}, 25)
string = tostr(words ? tostr("", words, "") | "", " [")
for x in (colors[1..toint(perc / 4)])
string = tostr(string, "|")
endfor
extra = 25 - perc / 4
if (extra)
string = tostr(string, $su:space(extra, " "))
endif
string = tostr(string, "] ", of, "/", what, " ", perc, "%")
return string
"Last modified by Dax (#789) on Tue May 3 14:14:13 2005 MDT."
.
0