Someone ICQ'd me about a progress bar I used once, in a tunnel-finding script. So I looked up the code, and thought I'd post it for those interested. Obviously, a progress bar can't accurately predict every routine, but one like this one with a known starting point (sector 11) and a known ending point (SECTORS), it works accurately.
Attachment:
ProgressBar.jpg [ 6.11 KiB | Viewed 5044 times ]
Here is the pertinent code:
echo ANSI_15 "*Finding Tunnels : Status (| = 10%)*"
echo ANSI_15 "1% 100%" #27 "[14D"
setVar $a 11
setVar $increment ((SECTORS - 11) / 10)
setVar $coefficient 1
while ($a <= SECTORS)
if ($a > ($coefficient * $increment))
echo ANSI_12 "|"
add $coefficient 1
end
# Do the real work here
add $a 1
end
The only confusing bit of code is #27 "[14D". That is the Escape code sequence to move the cursor 14 spaces left, to the first space of the progress bar.
If memory serves, I made that script to mirror the functions of a SupG tunnel script, which also had a progress bar of sorts. And in truth, I had a much more sophisticated bubble script at the time which also found tunnels, but I dumbed it down and released that "simple" tunnel routine... just to stick it to the little guys.
Enjoy,
+EP+