www.ClassicTW.com
http://classictw.com/

ANSI Progress Bar
http://classictw.com/viewtopic.php?f=15&t=26014
Page 1 of 1

Author:  ElderProphet [ Tue May 18, 2010 9:37 pm ]
Post subject:  ANSI Progress Bar

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
ProgressBar.jpg [ 6.11 KiB | Viewed 5903 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+

Author:  LoneStar [ Wed Mar 27, 2013 6:42 pm ]
Post subject:  Re: ANSI Progress Bar

Thanks for posting that routine E.P.

Very Cool

Author:  ElderProphet [ Wed Apr 03, 2013 7:47 pm ]
Post subject:  Re: ANSI Progress Bar

Heh, I'd forgotten that post, thanks for the props. I especially enjoyed my remark about sticking it to the little guys. It's always fun to look back and see you were a smart butt.

Let me know if there's something that would make that more helpful (like further explanation).

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/