Board index » delphi » pipe code source needed

pipe code source needed

Does anyone have any pascal source on how to use pipe color codes that are
 used in most bbs's?  Any help would be cool.... thanks.
 

Re:pipe code source needed


Quote
CastIron wrote:
> Does anyone have any pascal source on how to use pipe color codes that > are
> used in most bbs's?  Any help would be cool.... thanks.

        The conversion is quite simple...here's some pascal source. I -think-
this is what you're looking for. Note that some of these variable names are a
little non-descriptive, and some of the stuff that happens is related to
other parts of the program, so they may not make sense, but u should get the
basic idea here.

**************<SNIP!>**************

{* first, read the firstchar of the file into the var CHARBUFF  }
{* Each EOLN in my file is a #0 character. U can change it to   }
{* "While not eof(data) do" if ya want.                               }

while (not eof(data)) and (charbuff <> '*') do
      begin {EOF Loop}
      while charbuff<>#0 do
         begin {EOLN Loop}
           if charbuff = '|' then
              begin {any charbuf starting with a PIPE}
                   read(data,charbuff);
                   if charbuff = '0' then
                      begin {any PIPE starting with 0}
                           read(data,charbuff);
                           if (charbuff <> '8') and (charbuff <> '9') then
                              if (lasttime = 'a') or (pos=1) then
                                 write(finansi,' [0;')
                              else
                                  write(finansi,' [')
                           else {cb = '8'} if charbuff='8' then
                               write(finansi,' [1;30m')
                           else write(finansi,' [1;34m');

                           case charbuff of
                                '1': write(finansi,'34m');
                                '2': write(finansi,'32m');
                                '3': write(finansi,'36m');
                                '4': write(finansi,'31m');
                                '5': write(finansi,'35m');
                                '6': write(finansi,'33m');
                                '7': write(finansi,'0m');
                                end; {of cases for under 10}
                          lasttime :='u';
                          inc(pos);
                     end {for any charbuff with the 1st # = 0}
                   else {if the number is GREATER than 10}
                       begin {if number > 10}
                            if (lasttime = 'u') or (pos=1) then
                               write(finansi,' [1;')
                            else
                                write(finansi,' [');
                            read(data,charbuff);
                            case charbuff of
                                 '0': write(finansi,'32m');
                                 '1': write(finansi,'36m');
                                 '2': write(finansi,'31m');
                                 '3': write(finansi,'35m');
                                 '4': write(finansi,'33m');
                                 '5': write(finansi,'37m');
                                 end; {of cases ABOVE 10}
                            lasttime := 'a';
                            inc(pos);
                       end; {if number > 10}
                       read(data,charbuff);
                  end {If PIPE CODE}
              else {if there isn't a PIPE CODE}
                     if lasttime <> 'x' then
                     begin
                        write(finansi,charbuff);
                        read(data,charbuff);
                     end;
           end; {EOLN}
       writeln(finansi);
       readln(data);
       read(data,charbuff);
       write(finansi,'     ');
    end; {EOF}

**************<SNIP!>**************

        If you use this source, please credit me in your dox. Also, if u have
any questions, feel free to ask!

----------------------------------------------------------------------
    Paul Matthews - Lead Programmer : Creative Logic Software
     Check out Reality's Fringes at http://www.singnet.com.sg/~pmatth/
----------------------------------------------------------------------

Other Threads