home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / TRIDV183.ZIP / EXAMPLE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-01-30  |  5.2 KB  |  198 lines

  1. program example_using_TriDoor;
  2.  
  3. {**************************************************************************
  4.  
  5.    TEST.PAS/.EXE
  6.  
  7.    This  odd little program uses  the  unregistered TriDoor  unit and the
  8.    QuickBBS  support file  DORINFO1.DEF  (included  in  this  package) to
  9.    demonstrate some of the TriDoor features and commands.
  10.  
  11.    It also  shows how  very simple it  is to write a basic  on-line  door
  12.    using this unit- it took me about  30 minutes  at 2:00 in  the morning
  13.    to write this program.
  14.  
  15.    This program is compilable and will run on-line as well as locally!
  16.  
  17.  **************************************************************************}
  18.  
  19. uses
  20.   dos,                              { these units are not necessary for }
  21.   crt,                              { all programs                      }
  22.  
  23.   tridr55u;                         { change u to p or c for registered }
  24.                                     { private or commercial copies      }
  25.  
  26. {* * * * * * * * * *}
  27.  
  28. procedure example_showfile;
  29.  
  30. var
  31.   filename : string;
  32.   waitkey  : char;
  33.  
  34. begin
  35.  
  36.   clearcom;
  37.   print('This is a demonstration of the showfile() procedure.  It will also||');
  38.   print('use  the getinput() function, the aysure()  function  and the CAPS||');
  39.   print('boolean variable  that forces capitalized input  at the getinput()||');
  40.   print('function.||');
  41.   print('------------------------------------------------------------------||||||');
  42.  
  43.   repeat
  44.  
  45.     print('||||Enter a filename to be displayed : ');
  46.     caps := true;
  47.     filename := getinput(40);
  48.     print('||');
  49.  
  50.   until (showfile(filename,21)) or (not aysure('File not found. Try again',No))
  51.     or (offline) or (quit);
  52.  
  53.   print('||Press any key to continue : ');
  54.   waitkey := getkey;
  55.  
  56. end;
  57.  
  58. {* * * * * * * * * *}
  59.  
  60. procedure example_getinput;
  61.  
  62. var
  63.   workstrg1,
  64.   workstrg2  : string;
  65.   waitkey    : char;
  66.  
  67. begin
  68.  
  69.   clearcom;
  70.   print('This is a series of examples using the getinput() function. It will||');
  71.   print('demonstrate all of it''s features and abilities.||');
  72.   print('-------------------------------------------------------------------||||||');
  73.  
  74.   print('Here is an example of limited character input : ||');
  75.   print('Enter your name (10 chars max ) : ');
  76.   workstrg1 := getinput(10);
  77.   print('||||');
  78.  
  79.   print('Here is an example of coded input : ||');
  80.   print('Enter a password to use on this system (8 chars max) : ');
  81.   code := true;
  82.   workstrg2 := getinput(8);
  83.   print('||You entered the password '+ucase(workstrg2)+'.||||||');
  84.  
  85.   print('Here is an example of capitalized input : ||');
  86.   print('Enter a file name to download : ');
  87.   caps := true;
  88.   workstrg2 := getinput(12);
  89.   print('||||||');
  90.  
  91.   print('Press any key to continue : ');
  92.   waitkey := getkey;
  93.  
  94. end;
  95.  
  96. {* * * * * * * * * *}
  97.  
  98. procedure example_ansi;
  99.  
  100. var
  101.   ch : char;
  102.  
  103. begin
  104.  
  105.   clearcom;
  106.  
  107.   if stats.ansi then
  108.     begin
  109.  
  110.       ancolor(0,0,CYAN,BLACK);
  111.       print('This ');
  112.       ancolor(0,0,RED,BLACK);
  113.       print('is ');
  114.       ancolor(0,INTENSITY,BLUE,BLACK);
  115.       print('an ');
  116.       ancolor(0,INTENSITY,CYAN,BLACK);
  117.       print('example ');
  118.       ancolor(0,INTENSITY,MAGENTA,BLACK);
  119.       print('of ');
  120.       ancolor(0,0,GREEN,BLACK);
  121.       print('color');
  122.       ancolor(BLINK,INTENSITY,YELLOW,BLACK);
  123.       print('!');
  124.  
  125.       ancolor(0,0,CYAN,BLACK);
  126.       angotoxy(10,10);
  127.       print('Color and ANSI screen controls');
  128.       angotoxy(12,12);
  129.       ancolor(BLINK,INTENSITY,WHITE,BLUE);
  130.       print('CAN BE FUN!!!');
  131.       ancolor(0,0,WHITE,BLACK);
  132.  
  133.       angotoxy(1,17);
  134.  
  135.     end
  136.   else
  137.     begin
  138.       print('This portion of the program uses ANSI support and it has detected||');
  139.       print('that you do not use ANSI screen commands.||||');
  140.     end;
  141.  
  142.   print('Press any key to continue : ');
  143.   ch := getkey;
  144.  
  145. end;
  146.  
  147. {* * * * * * * * * *}
  148.  
  149. procedure wrapup;
  150.  
  151. var
  152.   ch : char;
  153.  
  154. begin
  155.   clearcom;
  156.  
  157.   print('||||||');
  158.   print('          Well, that  is the  end of  our  VERY  basic  demonstration.||||');
  159.   print('          The problem with  this sort  of thing  is that  there are SO||');
  160.   print('        MANY  different  types  of  things  that you  can created with||');
  161.   print('        TriDoor  that in order  to cover them  all I  would be sitting||');
  162.   print('        here for thirty years or so.||||');
  163.   print('          The best way to get  your hands on  some useful  examples is||');
  164.   print('        to call our BBS.  We will be making and putting up such things||');
  165.   print('        in our free time.||||');
  166.   print('          Once again, the number for Triumph BBS is (508)263-4247.||||||');
  167.  
  168.   print('Press any key to return to DOS : ');
  169.   ch := getkey;
  170.  
  171. end;
  172.  
  173. {* * * * * * * * * *}
  174.  
  175. begin
  176.   if readquick then                 { readquick for QuickBBS or make your }
  177.     begin                           { own support procedure - see docs    }
  178.  
  179.       setup;
  180.  
  181.       example_getinput;
  182.       example_showfile;
  183.       example_ansi;
  184.  
  185.       wrapup;
  186.  
  187.       clearcom;
  188.       print('Bye from the TriDoor example program!');
  189.  
  190.     end
  191.   else
  192.     begin
  193.       clrscr;
  194.       writeln;
  195.       writeln('File DORINFO1.DEF not found!',chr(7));
  196.     end;
  197.  
  198. end.