/*) Meter v1.0 by Josef Faulkner (panther@gate.net)  IRC: Arexx
\\\ Written for Grapevine 2.0 beta
///
\\\ Usage: /meter <percent> <label>
/// <label> will be placed in the box with "OMeter" appended to it
\\\ ie label=Lame will give you [LameOMeter]
/// <percent> can be any number from -25 to 200, if over 200 a + is added
\\\ if under 25, - is appended
(*/
parse arg pct label
label=strip(label)
num=pct
text='['label'OMeter]'
if pct<0 then do
        if pct<-25 then do
                pct=25
                text=text||'-'
        end
        pct=pct-2.5
        pct=abs(pct%5)
        do n=1 to pct
                text=text||'«'
        end
        text=text||'|0%-----25%-----50%-----75%-----100%|'
end
else if pct<=25 then do
        text=text||'|0%'
        pct=(pct+2.5)%5
        call addbar
        call addspace
        text=text||'25%-----50%-----75%-----100%|'
end
else if pct<50 then do
        text=text||'|0%'
        pct=(pct-22.5)%5
        text=text||'»»»»»25%'
        call addbar
        call addspace
        text=text||'50%-----75%-----100%|'
end
else if pct<75 then do
        text=text||'|0%'
        pct=(pct-47.5)%5
        text=text||'»»»»»25%»»»»»50%'
        call addbar
        call addspace
        text=text||'75%-----100%|'
end
else if pct<100 then do
        text=text||'|0%'
        pct=(pct-72.5)%5
        text=text||'»»»»»25%»»»»»50%»»»»»75%'
        call addbar
        call addspace
        text=text||'100%|'
end
else if pct=100 then do
        text=text||'|0%'
        text=text||'»»»»»25%»»»»»50%»»»»»75%»»»»»100%|'
end
else if pct>100 then do
        text=text||'|0%'
        num=pct
        pct=(pct-97.5)%5
        text=text||'»»»»»25%»»»»»50%»»»»»75%»»»»»100%|'
        if num>200 then do
                addplus=1
                pct=20
        end
        else addplus=0
        call addbar
        if addplus then text=text||'+'
end
text=text||'('num'%)'
'say 'text
exit

ADDBAR: 
        do n=1 to pct
                text=text||'»'
        end
return
ADDSPACE:
        do n=1 to 5-pct
                text=text||'-'
        end
return
