home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / DOOR / DDPLUS67.ZIP / DDPLUS.DOC < prev    next >
Text File  |  1994-11-22  |  81KB  |  1,808 lines

  1.           DDPLus Version 6.7 Door Driver Toolkit for Turbo Pascal
  2.             
  3.  
  4.                                 DISCLAIMER
  5.                                 ----------
  6.  The contributors have taken every precaution to insure that no harm or
  7.  damage will occur on computer systems operating this package. Nevertheless,
  8.  they shall NOT be held liable for whatever may happen on your computer
  9.  system or to any computer systems which connects to your own as a result of
  10.  operating this package. The user assumes full responsibility for the correct
  11.  operation of this software package, whether harm or damage results from
  12.  software error, hardware malfunction, or operator error. NO warranties are
  13.  offered, expressly stated or implied, including without limitation or
  14.  restriction any warranties of operation for a particular purpose and/or
  15.  merchantability. If you do not agree with this then do NOT use DDPLUS.
  16.  
  17.  
  18.               COPYRIGHT INFORMATION ON DDPLus TOOLKIT (C)
  19.               ---------------------------------------------------
  20.  Most of the source code for the DDPlus package comes from the original Door
  21.  Driver Kit 5.0 and that code is copyrighted by Scott Baker and Derrick
  22.  Parkhurst. This copyright includes all source code and sample doors
  23.  originated by them. These authors have permitted the original code to be
  24.  published as Freeware, although they still retain copyrights to their
  25.  original material.  All other material, other then the original Scott
  26.  Baker/Derrick Parkhurst items, is Copyrighted by Steven Lorenz and Bob
  27.  Dalton who are solely responsible for it's content, not to mention any
  28.  bugs <grin>.  
  29.         
  30.                              LICENSE AGREEMENT
  31.                              -----------------
  32.  The program source code, support files, and documentation NOT part of the
  33.  the original Door Driver Kit package are copyrighted products of Steven
  34.  Lorenz and Bob Dalton.  These authors reserve all rights to these products.
  35.  This is protected by the United States of America (USA) and International
  36.  Copyright Laws. You may modify or use the the enclosed source code for your
  37.  programs but you may NOT distribute DDPLUS source code modifications as
  38.  part of the DDPLUS package. In cases where this may infringe on the
  39.  Copyrights of the original Door Driver Kit authors, then their Copyrights
  40.  will take precedence.
  41.         
  42.  Tampering with or altering the contents or integrity of the DDPlus software
  43.  package is prohibited IF you intend to give a copy of the DDPLus archive
  44.  package to others. No fee may be charged by any agency beyond the cost of
  45.  distributing copies. The bottom line folks: Don't make any changes in this
  46.  package and redistribute as coming from us, and you can't re-label or modify
  47.  the DDPLUS package and market it as your own!
  48.  
  49.             WHAT'S IT GOING TO COST YOU TO USE THIS PACKAGE?
  50.             ------------------------------------------------                     
  51.  Nothing! The DDPlus package is distributed as FREEWARE and requires NO
  52.  registration and NO royalties for door products produced with this package.
  53.  We will NOT however turn down a registered copy of any program created
  54.  with this package if it is offered to us in appreciation for all the work
  55.  involved <grin>. These will ALWAYS be gladly accepted! (Hey, we ARE
  56.  sysops as well as programmers after all!!)
  57.      
  58.                              INTRODUCTION:
  59.                              ------------
  60.  DDplus is a package of pascal units for use in creating programs for
  61.  use with Bulletin Board Systems (BBS).  These programs are called "DOORS"
  62.  and are stand alone products which "link" with the BBS to allow users
  63.  to enjoy games and utilities of all types.  The DDPlus package takes the
  64.  tedium out of Door programming by allowing you to concentrate on the
  65.  writing of door specific code and not having to worry about details such
  66.  working with fossils, multi-tasker support, handling communications I/O and
  67.  the processing of BBS drop Files.    
  68.  
  69.                           Features of DDPLUS:
  70.                           -------------------
  71.                  1. IRQs 0-15 are supported.
  72.                  2. Comports 1-4 supported.
  73.                  3. Selectable Port Addresses.
  74.                  4. DV aware routines.
  75.                  5. Detects Rip.
  76.                  6. Fast and correct ansi color routines.
  77.                  7. Lock baud and comm baud rates to 115,200
  78.                  8. Built in Windows,WindowsNT,OS/2,DOS 5.0+ time
  79.                      slice releasing.
  80.                  9. Fossil support to 38,400 using normal fossil calls.
  81.                 10. Fossil support to 115,200 using extended
  82.                      fossil calls. Use XFossil for any fossils (X00 or
  83.                      BNU) over 38,400.  This option does not open or
  84.                      close the fossil but meerly writes to it the way
  85.                      it is.
  86.                 15. Local video can be toggled off to save processing
  87.                      time in multitasking windows or to give some user
  88.                      privacy when competing in game against the sysop.
  89.                 16. Multiple control files can be accessed by a
  90.                      command line parm.
  91.                 17. Will work with OR without the presence of a fossil.
  92.                 18. ALL source code is provided and you modify it to
  93.                      do whatever you need it to do!  Just be sure to
  94.                      document your changes as new versions of DDPLUS
  95.                      come out periodically and will not have your changes
  96.                      in them.
  97.  
  98.                              REQUIREMENTS:
  99.                              ------------
  100.  At this point in time the only requirements are that you must be using
  101.  Turbo Pascal version 6.0 or 7.0.  If you use file locking and sharing
  102.  then users must be notified that SHARE is required to be loaded prior
  103.  to use. The same goes for ANSI.SYS as well if ANSI graphics are used.
  104.  
  105.                             Files Included
  106.                             --------------
  107.  Below is a listing of all files for the this Package. Feel free to give
  108.  out copies of the ENTIRE archive package but please make sure all the
  109.  files below are in that package:
  110.  
  111.  DVAWARE.ASM  - DDPlus support source code unit.
  112.  SLASYNC.ASM  - DDPlus support source code unit.
  113.  SAMPLE1.BAT  - A sample BAT file which runs a DDPlus game program from the
  114.                   game directory. Feel free to distribute these batch
  115.                   files with your DDPLus game package creations.
  116.  SAMPLE2.BAT  - A sample BAT file which runs a DDPlus game program from any 
  117.                   node directory. Feel free to distribute these batch
  118.                   files with your DDPLus game package creations.
  119.  SAMPLE3.BAT  - A sample BAT file identical to the one I use on my Single
  120.                   node WildCat Support BBS to run my DDPlus Games. Feel free
  121.                   to distribute these batch files with your DDPLus game
  122.                   package creations.
  123.  GAME.CTL     - Un-edited Control file for use with all games produced  
  124.                   with DDplus package.  Provided mainly for information
  125.                   as DDSET661.ZIP now provides a VGA setup program for
  126.                   inclusion with programs made with this package.
  127.  FILE_ID.DIZ  - Ascii Description File for BBS Sysops on DDPLUS67.ZIP
  128.  DDPLUS.DOC   - The file you are now reading.
  129.  HISTORY.DOC  - History file of changes made to the DDPlus package.
  130.  SYSOP.DOC    - A sample SYSOP.DOC file I include with my DDPlus game
  131.                  packages to explain to sysops how to setup up the
  132.                  DDPlus Game with THEIR BBS system.  Feel free to modify
  133.                  this file for your door products and distribute it with
  134.                  YOUR DDPlus creations. All we ask is that you keep us
  135.                  in the credits section of the document file. Hey, it's
  136.                  only fair we get some credit....
  137.  DVAWARE.OBJ  - DDPlus support unit (compiled)
  138.  SLASYNC.OBJ  - DDPLus support unit (compiled)
  139.  ASYNC2.PAS   - DDPlus support source code unit.
  140.  BBSLIST.PAS  - Example source code for a simple door from Scott Baker.
  141.  COMIO.PAS    - DDPlus support source code unit.
  142.  DDANSI2.PAS  - DDPlus support source code unit.
  143.  DDFOSSIL.PAS - DDPlus support source code unit.
  144.  DDOVR.PAS    - DDPLus support source code unit.
  145.  DDOVR2.PAS   - DDPlus support source code unit.
  146.  DDPLUS.PAS   - Main DDPlus source code unit. Needs to be compiled.
  147.  DDSCOTT.PAS  - DDPlus support source code unit.
  148.  INITOVER.PAS - A sample overlay initialization unit. Can be used to
  149.                  automatically provide overlay support. Not part of
  150.                  DDPlus but provided to help out new door programmers.
  151.  JUNGLE.PAS   - Example source code for a simple door from Scott Baker.
  152.  MISC.PAS     - A utility unit with several "must have" procedures
  153.                  and functions for use with any door. Not part of
  154.                  DDPlus but provided to help out new door programmers.
  155.  NEWS.PAS     - Example source code for a simple door from Scott Baker.
  156.  NUMDOOR.PAS  - Example source code for a simple door from Scott Baker.
  157.  DDSET661.ZIP - VGA Setup program for distribution with doors you
  158.                  make using the DDPlus Package.  Freeware.
  159.  
  160.                   Installation and Preparation for Use
  161.                   ------------------------------------
  162.  
  163.  1. Move this package to a temporary diirectory and "unzip". Do not
  164.      at this time unzip the DDSET661.ZIP package. The DDSET661.ZIP
  165.      package is for distribution with DDPLus created products, although
  166.      you will probably want to use it yourself for testing, etc..
  167.  
  168.  2. Using Turbo Pascal 6.0 or 7.0 compile DDPLUS.PAS.
  169.  
  170.  3. AFTER compiling, move ALL files ending with the extension TPU or OBJ
  171.      to your Pascal units directory.
  172.  
  173.  4. That's all you have to do!  The package is now ready to use in your
  174.     door programs.
  175.  
  176.                          WHAT ARE DROP FILES?
  177.                          --------------------
  178.  When the BBS transfers control to a door program it provides a file,
  179.  called a "DROP FILE" to the door program which contains essential
  180.  information such as the users name, time remaining, com port, connect
  181.  speed, etc..  The format for this "DROP FILE" varies from BBS to BBS.
  182.  At this time the DDPlus Package supports the following drop file formats:
  183.  
  184.        DOORSYS - The DOOR.SYS format (Wildcat!,GAP,TAG, etc)
  185.        RBBS - Rbbs version 16.1+  (uses DORINFOx.DEF*)
  186.        QUICK - Quickbbs,Force,R.A. (uses DORINFOx.DEF**)
  187.        PCB12 - Pcboard version 12 (note: see COMPORT note below)
  188.        PCB14 - Pcboard version 14
  189.        PCB15 - Pcboard version 15
  190.        PHOENIX - Phoenix bbs (uses INFO.BBS)
  191.        SPITFIRE - Spitfires bbs (uses SFDOORS.DAT)
  192.        WWIV - WWIV bbs (uses CHAIN.TXT)
  193.        2AM - 2 A.M. software (uses JUMPER.DAT)
  194.        TRIBBS - TriBBS software (uses TRIBBS.SYS)
  195.        CALLINFO - Old Wildcat 2.xx(obsolete dropfile CALLINFO.BBS)
  196.  
  197.                       THE DOOR CONTROL FILE (CTL)
  198.                       ---------------------------
  199.  To run properly DDPlus requires configuration information from a control
  200.  (CTL) file.  For your use a GAME.CTL file is enclosed with this package.
  201.  The GAME.CTL file is unedited and heavily commented so that you might
  202.  understand what each line does.  Note that lines beginning with the ";"
  203.  character are NOT read by the DDPlus program unit.  This CTL file tells
  204.  the DDPlus portion of your program how to act, what drop file to use, etc.
  205.  It should be noted that a program produced with DDPlus will NOT function
  206.  without the presence of a CTL file.  The CTL file can be renamed, such
  207.  as GOC.CTL or RAW.CTL and is loaded and processed automatically when your
  208.  program calls "INITDOORDRIVER" (explained below).  It has been our 
  209.  experience that most problems experienced by users of doors made with
  210.  DDPlus are from improperly configured CTL files.  To help correct this
  211.  Steven Lorenz has created a standard CTL setup program which can be
  212.  distributed with your programs and is FREEWARE.  This setup program
  213.  (DDSET661.ZIP) provides VGA and mouse support and is very professional
  214.  is appearance.  It is also suggested that you provide a copy of the
  215.  GAME.CTL file with your door packages for user information purposes and
  216.  as a backup in those rare cases where the CTL setup program does not
  217.  function correctly because of an odd system configuration.
  218.  
  219.                        Command Line Parameters
  220.                        -----------------------
  221.  DDPlus supports several parameters which may be specified on the command
  222.  line. These parameters are handled automatically when you call 
  223.  "INITDOORDRIVER".  An example would be if you wanted to run the GodFather
  224.  of Crime Door Game locally then you would type the Command Line
  225.  parameter:  GOC /L
  226.  The following is a list of DDPlus supported Command Line Parameters.  
  227.  
  228.       "/Bxxxxx"   This tells GAME.EXE to lock its baud rate at
  229.       xxxxx.  In order to get the most efficiency out of a high speed
  230.       error correcting modem (9600 baud or above), you may lock the baud
  231.       rate to a speed higher than what the caller is actually using.
  232.       By locking the baud to say 38,400, the modem can compress text data
  233.       that is being sent and achieve a baud rate much higher than the
  234.       actual transmission rate.
  235.       This will lock the baud rate at the same value for all nodes that
  236.       use this command line.  If you perfer a more selective way to lock
  237.       baud use 'LOCKBAUD' command in the GAME.CTL file.
  238.  
  239.       "/Cx"     (where x is 1..4) This specifies a comport number.
  240.       Some bbs software does not create door information files (dropfiles)
  241.       that contain the comport number.  If your bbs does have a comport
  242.       listed in the dropfile then there is no need for this parameter.
  243.       The default is comport 0, local mode.
  244.  
  245.       "/E" - Expanded Memory Specification If your machine has over one
  246.       megabyte of memory, then you may have some available.  GAME.EXE can
  247.       utilize EMS to improve game performance and reduce conventional
  248.       memory requirements.
  249.       This command will tell GAME.EXE   to use EMS memory to hold its
  250.       overlay buffer.  Otherwise disc area may be used to hold this buffer.
  251.       This needs a memory manager and when enabled and is compatible with
  252.       DESQview.
  253.  
  254.       "/L"      This tells GAME.EXE to load up in LOCAL mode.
  255.       This is good for testing or when a sysop just wants to "try out" the
  256.       door without messing with his BBS setup.  The "/L" mode will ask the
  257.       user for his name and run the door in local mode.
  258.  
  259.       "/Nx"     (where x is 1..9) This specifies a "node number".
  260.       Some bbs software support multinode environments in which you must
  261.       know the node number of the drop file to use. For example, RBBS-PC
  262.       uses DORINFOx.DEF. If you specified "/N2" then GAME.EXE would use
  263.       DORINFO2.DEF.
  264.  
  265.       "/Mx"     (where x is up to 2 filename acceptable characters)
  266.       Used to specify one of Multiple control files.  If you have created
  267.       more than one GAME.CTL file (GAME1.CTL, GAME2.CTL, etc.) for each
  268.       node or network PC then you can select the one you want by using
  269.       the /M parm.
  270.       Example:  "/M2" will force GAME.EXE to use GAME2.ctl.
  271.  
  272.       "/Pyyy"   This specifies the path to the drop files.
  273.       For example, "/PC:\WILDCAT\WCWORK\NODE1" would tell GAME.EXE to
  274.       look for the drop file in C:\WILDCAT\WCWORK\NODE1. If this is left
  275.       out the program assumes the drop file is local.
  276.  
  277.       "/V"    This command will tell GAME.EXE not to show any display
  278.       on the local screen.  Only a colored screen and a message will be
  279.       displayed.  The cursor will not move as it will be turned off.
  280.       Saves a little processing on multi-tasking systems.
  281.  
  282.       "/W"      This flags the program that a network is present even
  283.       though no multitaskers are detected.  This is useful if the door is
  284.       run on a network such as Novell that doesn't use multitaskers.
  285.  
  286.                        Special Note on RIP Support
  287.                        ---------------------------
  288.  DDplus can detect if RIP is present but YOU must program in any code to
  289.  make use of RIP.  The extent of RIP support is to provide for both
  290.  detection AND to pass a variable which tells your program that the
  291.  door user has RIP.
  292.  
  293.                    Special Note on Multi-Tasker Support
  294.                    ------------------------------------
  295.  DDplus can detect the presence of DesqView, OS2, Windows 3.1, and Windows
  296.  NT and provide automatic time slice releasing to them. All without any
  297.  coding required on your part.
  298.  
  299.  --------------------------------------------------------------------------
  300.  SPECIAL NOTE:  The following sections are from the original door driver
  301.  documentation from Scott Baker and have been changed to allow them to
  302.  be consistent with the the updates reflected in the DDPlus package.
  303.  --------------------------------------------------------------------------
  304.  
  305.                        Overview of DDPlus Routines
  306.                        ---------------------------
  307.  The procedures, functions, and variables in DDPLus usually fall in one
  308.  of the following categories:
  309.  
  310.               * INPUT [INP]
  311.  
  312.                         Get information from the user who is online.
  313.                         Example: SREAD() which performs the
  314.                         functional equivelant of READLN().
  315.  
  316.               * OUTPUT [OUT]
  317.  
  318.                         Send information to the user. Example:
  319.                         SWRITE() which performs the equivelant of
  320.                         WRITE().
  321.  
  322.               * INFORMATIONAL [INF]
  323.  
  324.                         Provide information about the user, such as
  325.                         his name, baud rate, etc. Example:
  326.                         USER_FIRST_NAME which stores the current
  327.                         user's first name.
  328.  
  329.                         Informational variables are usually
  330.                         read-only, but some can be written to as
  331.                         well. Use common sense and you should get
  332.                         by.
  333.  
  334.               * CONTROL [CTL]
  335.  
  336.                         Procedures which perform various control
  337.                         functions over how DDPLUS operates.
  338.  
  339.  In the sections to follow, all functions/procedures/etc will be placed in
  340.  one of these categories for ease of use and easy identification.
  341.  
  342.                          Reference - Procedures
  343.                          ----------------------
  344.  
  345.           INITDOORDRIVER(filen: string);                   [CTL]
  346.  
  347.               This procedure MUST be called before any of
  348.           DDPlus's features are used. In fact, in most cases it
  349.           should be the first statement that your program executes.
  350.           The FILEN variable specifies the filename of the control
  351.           file that DDPlus will use (i.e. GAME.CTL).
  352.               InitDoorDriver does a variety of things including
  353.           loading and processing the control file, reading the drop
  354.           files, setting up serial I/O. It also sets up an "EXIT
  355.           Procuedure" which will automatically close down the serial
  356.           I/O when your program is finished.
  357.  
  358.           DISPLAYFILE(Filen: String);                      [OUT]
  359.  
  360.                This Procedure is usefull in that it will transfer an
  361.           Ascii or Ansi file, and will put "(C)ontinue, (S)top,
  362.           (N)onstop" to stop an Ascii file from scrolling of the
  363.           page and thus allowing the user to read this file at his
  364.           or her own speed.
  365.  
  366.  
  367.           DISPLAY_MACRO(s: string);                        [OUT]
  368.  
  369.                This procedure is used to display a macro-string. The
  370.           macro string is usually contained in the variable
  371.           MACRO_STRING.
  372.  
  373.  
  374.           PROMPT(var s: string; length: integer; hi: boolean); [INP]
  375.  
  376.                The prompt procedure is a high-level string input
  377.           routine. It allows you to specify the maximum length of
  378.           the input string and if HI is set to true, it will hilight
  379.           the input in reverse background. The colors for the prompt
  380.           routine are defined in the control file.
  381.  
  382.  
  383.           RECORD_MACRO(var s: string);                     [INP]
  384.  
  385.                This procedure allows the user to record a macro
  386.           string, up to 255 characters that will be invoked whenever
  387.           the CTRL-N key is pressed. The macro is stored in the
  388.           string variable S. To activate the macro capability, you
  389.           must place the macro into the string variable
  390.           "MACRO_STRING".
  391.  
  392.  
  393.           SCLRSCR;    { ANSI code }                        [OUT]
  394.  
  395.                This procedure clears the remote side's and the local
  396.           side's screen.
  397.  
  398.           SCRLEOL;                                         [OUT]
  399.  
  400.                This procedure will clear up to then end of the
  401.           current line. (note: only works when caller has ANSI
  402.           capabilities)
  403.  
  404.  
  405.           SET_FOREGROUND(b: byte); {chg SRL to byte }      [OUT]
  406.  
  407.                The set_foreground procedure sets the current
  408.           foreground color to the one specified by the byte
  409.           variable, b. The color is set both on the local side and
  410.           the remote side if the remote user has ANSI toggled on.
  411.           The acceptable range for the color is 0-31. Colors 0-15
  412.           are standard foreground colors and 16-31 represent colors
  413.           0-15 but in blinking mode.
  414.  
  415.           SET_COLOR(f,b: byte);  {by S. Lorenz }        [OUT]
  416.  
  417.                The set_color procedure sets the current foreground
  418.           color and background and are specified by the variable
  419.           bytes f and b. The color is set both on the local side and
  420.           the remote terminal if the remote user has toggled his
  421.           ANSI on. The acceptable range for the f is 0-31 and b is
  422.           0-7.  If the color is currently set to foreground or back-
  423.           ground then that process is skipped.  If a (7,0) is sent
  424.           then an ansi reset color code is sent.
  425.  
  426.           SET_BACKGROUND(b: byte);  {chg SRL to byte }     [OUT]
  427.  
  428.                The set_background procedure sets the current
  429.           background color to the one specified by the byte
  430.           variable, b. The color is set both on the local side and
  431.           the remote terminal if the remote user has toggled his
  432.           ANSI on. The acceptable range for the color is 0-7.
  433.  
  434.  
  435.           SGOTO_XY(x,y: integer);                          [OUT]
  436.  
  437.                Sgoto_xy allows you to position the cursor on the
  438.           local and remote screen. The valid range for X is 1 to 80
  439.           and the valid range for Y is 1 to 24.
  440.  
  441.           SREAD_CHAR(var c: char);                         [INP]
  442.  
  443.                This procedure waits for a character to be pressed
  444.           and then returns that character in the character variable.
  445.           No echoing is performed (i.e. the user will not see the
  446.           key he pressed). If you wish echoing, you must again write
  447.           the character with SWRITE below. This routine is useful
  448.           for writing your own lowlevel readln routines or
  449.           performing "hot-key" operations. It is a direct
  450.           replacement for CH:=READKEY.
  451.  
  452.           SREAD(var s: string);                            [INP]
  453.  
  454.                The sread procedure accomplishes the equivilant of
  455.           the Turbo Pascal procedure READLN. A string is read from
  456.           the user and wher the CR character is obtained, the
  457.           procedure exits with the string stored in the string
  458.           variable, s.
  459.  
  460.           SREAD_NUM(var i: integer);                       [INP]
  461.  
  462.                The sread_num procedure is almost identical to the
  463.           sread procedure except it will read an integer variable
  464.           instead of a string. Only the characters 0-9 are allowed
  465.           to be entered by the user. The value returned will be in
  466.           the range of -32768 to +32768.
  467.  
  468.  
  469.           SREAD_NUM_BYTE(var b: byte);                     [INP]
  470.  
  471.                The sread_num_byte procedure is almost identical to
  472.           the sread procedure except it will read an byte variable
  473.           instead of a string. Only the characters 0-9 are allowed
  474.           to be entered by the user. The value returned will be in
  475.           the range of 0 to 255.
  476.  
  477.  
  478.           SREAD_NUM_WORD(var w: word);                     [INP]
  479.  
  480.                The sread_num_word procedure is almost identical to
  481.           the sread procedure except it will read an word variable
  482.           instead of a string. Only the characters 0-9 are allowed
  483.           to be entered by the user. The value returned will be in
  484.           the range of 0 to 65535.
  485.  
  486.  
  487.           SREAD_NUM_LONGINT(var l: longint);               [INP]
  488.  
  489.                The sread_num_longint procedure is almost identical
  490.           to the sread procedure except it will read an longint
  491.           variable instead of a string. Only the characters 0-9 are
  492.           allowed to be entered by the user. The value returned will
  493.           be in the range of -2147483648 to +2147483647.
  494.  
  495.           SWRITE(s: string);                               [OUT]
  496.  
  497.                The swrite procedure is the equivilant of the Turbo
  498.           Pascal WRITE procedure. Swrite will simultaniously write
  499.           to both the local screen and the remote terminal. No CR/LF
  500.           sequence is added to the end of the string. (note: You may
  501.           also use WRITE(SOUTPUT,s))
  502.  
  503.  
  504.           SWRITELN(s: string);                             [OUT]
  505.  
  506.                The swriteln procedure is the equivilant of the Turbo
  507.           Pascal WRITELN procedure. Swrite will simultaniously write
  508.           to both the local screen and the remote terminal. A CR/LF
  509.           sequence is appended to the end of the string. (note: You
  510.           may also use WRITELN(SOUTPUT,s))
  511.  
  512.           DDASSIGNSOUTPUT(f: text);                        [CTL]
  513.  
  514.                This procedure assigns the simultanious output
  515.           channel to a text file. This is done automatically by
  516.           INITDOORDRIVER to SOUTPUT (i.e. DDASSIGNSOUTPUT(SOUTPUT).
  517.           But, if you wish to assign it to a different file, you may
  518.           do it with this procedure. For example:
  519.  
  520.           DDASSIGNSOUTPUT(my_output_file);
  521.           rewrite(my_output_file);
  522.           writeln(my_output_file,'This will go to both local and '+
  523.                                   'remote.');
  524.  
  525.                           Reference - Functions
  526.                           ---------------------
  527.  
  528.           SKEYPRESSED: Boolean;                            [INF]
  529.  
  530.                SKEYPRESSED will return TRUE if a key has been
  531.           pressed and is waiting to be read and FALSE if no key has
  532.           been pressed. It is the equivelant of Turbo Pascal's
  533.           KEYPRESSED function.
  534.                This also allows the program to pause until the user
  535.           presses a key. When used in a loop like this it stops
  536.           everything until user input occurs.
  537.  
  538.                Repeat Until skeypressed;
  539.  
  540.  
  541.           TIME_LEFT: Byte;                                 [INF]
  542.  
  543.                The time_left function returns the amount of time
  544.           left in minutes. This time is computed automatically by
  545.           DDPLUS for you.
  546.  
  547.                         Reference - Variables
  548.                         ---------------------
  549.           SOUTPUT: text;                                   [OUT]
  550.  
  551.                This text file is associated with the simultanious
  552.           output channel. It provides an alternate form of IO than
  553.           using swrite/swriteln. To use, simply treat SOUTPUT as it
  554.           were a normal text file. For example,
  555.  
  556.             Writeln(SOUTPUT,'This is a test'); is the same as
  557.           swriteln('This is a test');
  558.  
  559.             When is this useful? When you want to use WRITELN's
  560.           ability to write various data types (i.e. integers, reals,
  561.           etc) or it's ability to format output. For example:
  562.  
  563.             USING SWRITELN: str(integer_data,tempstr);
  564.           swriteln(tempstr);
  565.  
  566.             USING SOUTPUT:  writeln(soutput,integer_data);
  567.  
  568.           ALTKEYS: (see configurable alt key section)
  569.  
  570.           ALTHELP: (see configurable alt key section)
  571.  
  572.           ANSION: boolean;                                 [CTL]
  573.  
  574.               This variable controls whether local output (it has
  575.           nothing to do with remote) will go directly to the local
  576.           screen or if it will be sent through DDPLUS's
  577.           emulation routine. Since the emulation routine is slow in
  578.           comparison to direct output, this variable is defaulted to
  579.           FALSE. If you want to send your own ANSI codes to the
  580.           screen through SWRITE/SWRITELN, then you will have to set
  581.           this variable to TRUE.
  582.  
  583.           BAUD_RATE: integer;                              [INF]
  584.  
  585.                This variable holds the user's current baud rate.
  586.  
  587.           BBS_SOFTWARE: byte;                              [INF]
  588.  
  589.               The following numbers indicate software names:
  590.  
  591.           Number     Supported BBS                   DropFile Format
  592.           ------     ------------------------        --------------
  593.             1        Local Only Operation            N/A
  594.             3        QUICK                           DORINFOx.DEF
  595.             4        PC BOARD Vers 12                PCBOARD.SYS
  596.             5        WWIV                            CHAIN.TXT
  597.             6        PC BOARD Vers 15                PCBOARD.SYS
  598.             7        RBBS 16.1                       DORINFOx.DEF
  599.             8        PHOENIX                         INFO.BBS
  600.             9        WildCat Vers 2 or earlier       CALLINFO.BBS
  601.            10        PC BOARD Vers 14                PCBOARD.SYS
  602.            11        DOOR system format              DOOR.SYS
  603.                       (Wildcat 3.X or 4.X,GAP,TAG, etc)
  604.            12        SPITFIRE                        SFDOORS.DAT
  605.            13        2AM                             JUMPER.DAT
  606.            14        TRIBBS                          TRIBBS.SYS
  607.  
  608.  
  609.           BBS_TIME_LEFT: integer;                          [INF]
  610.  
  611.               This holds the amount of time that the user had left
  612.           when he entered the door. It is loaded from the DROP FILE
  613.           by INITDOORDRIVER. Note that this provides the time left
  614.           when the user ENTERED the door, not the current time left.
  615.           The current amount of time left is calculated by the
  616.           function TIME_LEFT.
  617.  
  618.           BOARD_NAME: String[70];                          [INF]
  619.  
  620.                Board_Name hold the current BBS's name that is set in
  621.           the control file.
  622.  
  623.           CHARORIGIN: CharOriginType;                      [INF]
  624.  
  625.                Returns either LocalChar or RemoteChar depending on
  626.           where the last sread_char was received from. This is
  627.           mainly used in the chat routine to set different
  628.           foreground colors for local and remote users.
  629.  
  630.           COM_PORT: byte;                                  [INF]
  631.  
  632.                Contains the current com port that serial output is
  633.           going to. Should be a zero if in local mode.
  634.  
  635.  
  636.           CURRENT_FORGROUND: byte;                         [INF]
  637.  
  638.                This variable stores the current foreground color.
  639.  
  640.  
  641.           CURRENT_BACKGROUND: byte;                        [INF]
  642.  
  643.                This variable stores the current background color.
  644.  
  645.           CURLINENUM: byte;                                [INF]
  646.  
  647.                This variable is used internally to control the more
  648.           prompt. It is incremented when a line of text is sent out.
  649.           When it reaches 24, a <more> is sent. This is of course,
  650.           providing that morechk:=true.
  651.                                                            [INF]
  652.           GRAPHICS: byte;
  653.  
  654.               Graphics specifies a text mode:
  655.  
  656.               1 : Ascii - General Text
  657.               2 : Ascii's Extended Graphics and General Text
  658.               3 : Ansi Color and Graphics
  659.               4 : Ansi Color and Graphics and Ansi Music (See
  660.                   Section on ANSI.TPU)
  661.               5:  RIP Color and Graphics
  662.          
  663.           LOCAL: boolean;                                  [INF]
  664.  
  665.               This boolean is alway true if in local mode and false
  666.           if in remote mode.
  667.  
  668.  
  669.           MINTIME: byte;                                   [INF]
  670.  
  671.                (check this - don't know)
  672.  
  673.           MORECHK: boolean;                                [CTL]
  674.  
  675.                This boolean allows you to toggle the more prompts on
  676.           or off. If TRUE, then DDPLUS will display a "more"
  677.           prompt every 24 lines.
  678.  
  679.           NODE_NUM: byte;                                  [INF]
  680.  
  681.                Returns the current Node that the door is running
  682.           under. Defaulted to 1 in a single node system. This
  683.           corresponds directly to the "/Nx" command line parameter.
  684.  
  685.  
  686.           NOTIME: String;                                  [CTL]
  687.  
  688.                (check this)
  689.  
  690.                When the users time limit has been reached this
  691.           string will be displayed then the user will be returned to
  692.           the bbs. This string has a default of "(***TIME LIMIT
  693.           EXCEEDED***)".
  694.  
  695.           STACKED: string;                                 [---]
  696.  
  697.                The Procedure sread and sreadln can have stacked
  698.           commands which is when a user type something in like this:
  699.  
  700.                             "m;101;m;102;m;103;m;104"
  701.  
  702.                Notice the ";"'s throughout the example. well this is
  703.           a stacked command. the ";"'s indicate a seperate
  704.           operation. This allows the user to type in multiple
  705.           operations to preform on one line and not have to go
  706.           through each and every prompt of the door. This can be
  707.           very useful when used in combi- nation with the
  708.           Record_Macro command.
  709.  
  710.           STATFORE: byte;                                  [CTL]
  711.  
  712.                The status line foreground.
  713.  
  714.  
  715.           STATBACK: byte;                                  [CTL]
  716.  
  717.                The status line background.
  718.  
  719.  
  720.           STATLINE: boolean;                               [CTL]
  721.  
  722.                A status line pops while any door is in operation if
  723.           this boolean is set true. The status line contains the
  724.           user name and the program name an the users time left.
  725.  
  726.  
  727.           SYSOP_FIRST_NAME: string[30];                    [INF]
  728.  
  729.                Returns the first name of the sysop. The name is
  730.           entered into door-driver through the control file.
  731.  
  732.  
  733.           SYSOP_LAST_NAME: string[30];                     [INF]
  734.  
  735.                Returns the last name of the sysop. The name is
  736.           entered into door-driver through the control file.
  737.  
  738.  
  739.           USER_FIRST_NAME: string[30];                     [INF]
  740.  
  741.                Returns the first name of the current user of the
  742.           door program. The user's name is determined from whatever
  743.           door information is passed from the bbs software.
  744.  
  745.  
  746.           USER_LAST_NAME: string[30];                      [INF]
  747.  
  748.                Returns the last name of the current user of the door
  749.           program. The user's name is determined from whatever door
  750.           information is passed from the bbs software.
  751.  
  752.  
  753.           USER_ACCESS_LEVEL: word;                         [INF]
  754.  
  755.                Returns the access level of the user. The user's
  756.           access level is determined from whatever door information
  757.           is passed from the bbs software.
  758.  
  759.  
  760.           PROGNAME: String[60];                            [CTL]
  761.  
  762.                This option must be set by the programmer, preferably
  763.           in the beginning of the door. It sets the name that will
  764.           be displayed centered on line 25 of the screen. It is
  765.           simply used for cosmetic purposes.
  766.  
  767.           MACRO_STRING: string;                            [INF/CTL]
  768.  
  769.                 The contents of this variable are treated as a
  770.           macro. Whenever the user types a CTRL-N, the string will
  771.           be output. The string may be easily recorded with the
  772.           RECORD_MACRO procedure and displayed with the
  773.           DISPLAY_MACRO procedure.
  774.  
  775.  
  776.           SETFORECHECK: boolean; (default=FALSE)           [CTL]
  777.  
  778.                 This variable when set to TRUE will cause DOORDRIV
  779.           to filter out repetetive SET_FOREGROUND() calls. If for
  780.           example, you set the foreground to gray, then set it to
  781.           gray again later while the foreground is still gray, the
  782.           second call would be ignored. This can spare the user from
  783.           the slowdown effects of meaningless, repetetive
  784.           SET_FOREGROUND calls.
  785.  
  786.                    Reference - Procedure Substitutions
  787.                    -----------------------------------
  788.           This section is provided to help you in figuring out which
  789.           DDPLUS routines you should call to replace turbo's
  790.           standard I/O routines.
  791.  
  792.           READKEY:
  793.  
  794.               Readkey is used in many normal programs to get a
  795.           single character. (i.e. CHAR:=readey). This can be
  796.           replaced by SREAD_CHAR(char);.
  797.  
  798.           WRITELN(xxxx);  (or WRITE(xxxx))
  799.  
  800.               The writeln procedure is probably the most common and
  801.           numerous change that you will have to make. DDPLUS
  802.           provides the SWRITE/SWRITELN procedures to do the job of
  803.           turbo's write/writeln. In addition, the SOUTPUT file is
  804.           also available. Let's take a look at some examples:
  805.  
  806.           Ex 1
  807.           ----
  808.            Convert "writeln('Scott was here!');"
  809.  
  810.               --> swriteln('Scott was here!');
  811.  
  812.            or --> writeln(soutput,'Scott was here!');
  813.  
  814.           Ex 2
  815.           ----
  816.            int is an integer.
  817.            Convert "write(int);"
  818.  
  819.               --> str(int,tempstr); swrite(tempstr);
  820.  
  821.            or --> write(soutput,int);
  822.  
  823.           Ex 3
  824.           ----
  825.            r is a real.
  826.            Covert "writeln(r:2:2);"
  827.  
  828.               ---> str(r:2:2,tempstr); swriteln(tempstr);
  829.  
  830.            or ---> writeln(soutput,r:2:2);
  831.  
  832.               As you can see, the SWRITE/SWRITELN method is easier
  833.           if you are using string type data, but the
  834.           write(SOUTPUT,xxx) method is better for numerical types.
  835.           You can use whichever you like.
  836.  
  837.  
  838.           CLREOL:
  839.  
  840.               You can replace CLREOL with SCLREOL, but please note
  841.           that it will only work when the caller has ANSI
  842.           capabilities. If the caller doesn't have ansi, then he'll
  843.           get a load of garbage.
  844.  
  845.  
  846.           CLRSCR:
  847.  
  848.               CLRSCR can be directly converted to SCLRSCR. This
  849.           works for either ANSI or non-ANSI users.
  850.  
  851.           GOTOXY(x,y):
  852.  
  853.               GOTOXY(x,y) can be converted into SGOTO_XY(x,y), but
  854.           again, this will only work for ansi users.
  855.  
  856.           READLN(string_variable) ---> SREAD(string_variable)
  857.  
  858.           READLN(integer_variable) ---> SREAD_NUM(integer_variable)
  859.  
  860.           READLN(word_variable) ---> SREAD_WORD(word_variable)
  861.  
  862.           READLN(long_variable) ---> SREAD_LONGINT(long_variable)
  863.  
  864.                            REFERENCE - Units
  865.                            -----------------
  866.  
  867.  The following is a brief list of the included units and what they do
  868.  here. 
  869.  
  870.                *DDPLUS.PAS
  871.  
  872.                This is the main unit that you need to use.
  873.  
  874.                *DDANSI2.PAS
  875.  
  876.                Contains procedures used by DDPLUS to display
  877.                ANSI on local screen.
  878.  
  879.                *DDFOSSIL.PAS
  880.  
  881.                Contains procedures used by DDPLUS to interact
  882.                with fossil drivers.
  883.  
  884.                *DDSCOTT.PAS
  885.  
  886.                Miscellanious procedures used by DDPlus.
  887.  
  888.  
  889.                *COMIO.PAS
  890.  
  891.                Medium-level COM I/O used by DDPlus.
  892.  
  893.                *ASYNC2.PAS/SLASYNC.OBJ
  894.  
  895.                Internal COM routines.
  896.  
  897.                *DVAWARE.OBJ
  898.  
  899.                Routines for support of Desqview
  900.                
  901.                *DDOVR.PAS
  902.  
  903.                Overlayable unit containing code that gets
  904.                information out of bbs drop files (i.e. DORINFOx.DEF, etc)
  905.  
  906.                *DDOVR2.PAS
  907.  
  908.                Overlayable unit that contains code to process
  909.                control file.
  910.  
  911.                      SAMPLE DOOR PROGRAM SOURCE CODE
  912.                      -------------------------------
  913.  Enclosed in this package is the source code to several simple door programs.
  914.  These remain copyrighted by Scott Baker.  They are:
  915.  
  916.     NEWS.PAS:  a program that he once wrote as an online
  917.     news reader for USA Today, Movie Review, and a few other
  918.     electronic magazine services. It's a good demonstration of
  919.     how to use ANSI, displayfile, and several of DDPlus's features.
  920.  
  921.     BBSLIST.PAS: a bbs list maintainer that he wrote some
  922.     while back. Like NEWS, it's a good example of ANSI in use.
  923.  
  924.     NUMDOOR.PAS:  A simple number guessing game he wrote.
  925.  
  926.     JUNGLE.PAS:  A story door where users keep adding to the story.
  927.     
  928.     Under Scott Baker's copyright you are free to use code in these
  929.     programs if you like, but he maintains a copyright on those programs.
  930.     If you do use this code, he expect to be "cut in" to whatever
  931.     extent the code was used. For example, if you developed BBSLIST.PAS
  932.     into a more powerful program and started distributing it, he
  933.     would expect a reasonable portion of whatever profits you make.
  934.  
  935.  --------------------------------------------------------------------------
  936.  SPECIAL NOTE:  The following tutorial was originally authored by Scott
  937.  Baker and has been modified for use with DDPlus.  The unaltered parts
  938.  remain copyrighted by him.
  939.  --------------------------------------------------------------------------
  940.  
  941.                         HOW TO WRITE A DOOR
  942.                         -------------------
  943.  *   Writing a BBS Door - Tutorial by Scott M. Baker
  944.  
  945.      Doors are programs written for a bulletin board system
  946.      to allow the user to perform other tasks than the bulletin
  947.      board  software  allows.   For example,  a  door  could be
  948.      anything  from a  bbs lister  to a  multiplayer simulation
  949.      (such  as  Galactic Warzone,  Yankee  Trader,  Trade Wars,
  950.      etc).  This  article will  be a  tutorial on  how to write
  951.      door  programs.  The  programs will  be  written  in Turbo
  952.      Pascal (version  6 or 7) and  will use  the DDPlus 
  953.      routines to  provide support for  RBBS, QuickBBS, Wildcat,
  954.      WWIV, etc.
  955.  
  956.      Right  now,  we're   just  going  to   stick  with  the
  957.      DDPLus routines since they are  the routines that I am
  958.      most familiar with.
  959.  
  960.                           REQUIREMENTS
  961.      What you'll need:
  962.  
  963.      - Turbo Pascal by Borland. Either version 6.0 or
  964.        7.0 will do.
  965.  
  966.      - DDPLUS67.ZIP. This is a DDPLUS support
  967.        package for TP6 and TP7 It includes async
  968.        support, bbs interfacing, etc. Available from
  969.        the TANSTAFL BBS (501-741-5699) (FIDO 1:391/3010).
  970.        If you have a 9600 baud or above modem you can freq
  971.        it from the TANSTAFL BBS using the magic name of DDPLUS.
  972.  
  973.      - A basic understanding of Pascal (specifically
  974.        Turbo   Pascal).  You   don't  need   to  be   a  Pascal
  975.        wizard or anything, but the more knowledge you
  976.        have, the better.
  977.  
  978.                    BASIC ELEMENTS OF A 'DOOR'
  979.  
  980.        Ok, time to  get started. First lets  talk about the basic
  981.        elements that a door needs.
  982.  
  983.        1) Async communications support.
  984.  
  985.        The door  must be  able to  talk to  the user  through the
  986.        communications  port.   Support  has  to  be  provided for
  987.        multiple com ports,  locked baud rates,  etc.  The program
  988.        also must monitor the presence of the CARRIER DETECT modem
  989.        line to  make sure  the carrier  is not  dropped while the
  990.        door is in use.
  991.  
  992.        2) BBS software interfacing.
  993.  
  994.        The door needs  to be able  to grab the  user's name, time
  995.        left,  and  other  associated  information  from  the  bbs
  996.        software.  Since bbs  programs lack standardization, there
  997.        are several  different methods  that have  to be accounted
  998.        for.
  999.  
  1000.        3) Support for ANSI (color) graphics and animation.
  1001.  
  1002.        Just about every door has ANSI capabilities these    days,
  1003.        so if  you want  yours to  be seriously  considered, you'd
  1004.        better have it as well.
  1005.  
  1006.        DDPlus  will  handle  the  first  two  points  for you
  1007.        automatically when  you call  the INITDOORDRIVER procedure
  1008.        described  below.  DDPlus has  support  for  the third
  1009.        point (ANSI graphics), but you'll need to use your own
  1010.        skills  in deciding  where you  wish  to put  colors, what
  1011.        colors to use, etc.
  1012.  
  1013.  
  1014.                             DDPLUS PROCEDURES
  1015.  
  1016.        There  are a  series  of procedures  that  DDPLUS will
  1017.        provide  to you  for  accomplishing these  tasks.  Without
  1018.        getting too complex, let's discuss a few of them:
  1019.  
  1020.        PROCEDURE INITDOORDRIVER(ctl_file_name: string);
  1021.  
  1022.        This procedure  initializes the door  support system, comm
  1023.        port,  grabs  the user  name,  and a  few  other necessary
  1024.        things.    The  variable   "ctl_file_name"  is   a  string
  1025.        containing the  name of  the control  file that  your door
  1026.        will use.  For now, let's just ignore the control file and
  1027.        use the sample included with the DD package.
  1028.  
  1029.        PROCEDURE SWRITE(out_str: string);
  1030.  
  1031.        This is DDPLUS's compliment to  the Write() statement of Turbo
  1032.        Pascal.  The "S"  stands for simultaneous.  Output will be
  1033.        written to both the remote user (through the com port) and
  1034.        the local screen.  "out_str" is the  string containing the
  1035.        data  you wish  to write.   Most of  your output  will use
  1036.        either this or the following SWRITELN procedure.
  1037.  
  1038.        PROCEDURE SWRITELN(out_str: string);
  1039.  
  1040.        Same  as SWRITE,  except  a carriage  return/line  feed is
  1041.        appended to  the end  of the  string.  This  is similar to
  1042.        TP's writeln statement.
  1043.  
  1044.        variable USER_FIRST_NAME: STRING;
  1045.  
  1046.        After INITDOORDRIVER  has been called,  this variable will
  1047.        contain the  user's first  name.  The  string will  be all
  1048.        upper-case.
  1049.  
  1050.        variable USER_LAST_NAME: STRING;
  1051.  
  1052.        Similar to USER_FIRST_NAME, this variable will contain the
  1053.        user's last name.  As with USER_FIRST_NAME, it is only
  1054.        valid after the call to INITDOORDRIVER has been made.
  1055.  
  1056.                          YOUR FIRST DOOR
  1057.  
  1058.        Now  that  you've  seen  a  few  of  DDPLUS's  support
  1059.        routines, lets put them to  work in the "hello door."  The
  1060.        hello door will  be simply a door  version of the standard
  1061.        hello program.  Meaning that  it displays "hello world" to
  1062.        the screen.  First, a note  about my code, I'll be placing
  1063.        line  numbers  ({1}, {2},  etc)  in the  code.   These are
  1064.        intended for discussion purposes and are not needed in the
  1065.        pascal program itself.
  1066.  
  1067.           HLODOOR.PAS:
  1068.  
  1069.           {1} Program HelloDoor;
  1070.           {2}
  1071.           {3} uses crt, ddplus;
  1072.           {4}
  1073.           {5} begin
  1074.           {6}   InitDoorDriver('GAME.CTL');
  1075.           {7}   swriteln('Hello World!');
  1076.           {8}   delay(5000);
  1077.           {9} end.
  1078.  
  1079.           Experienced pascal programmers will feel a bit insulted by
  1080.           the simplicity of the above program, but it is a necessary
  1081.           step in learning to use door driver.
  1082.  
  1083.  
  1084.                         COMPILING AND RUNNING THE DOOR
  1085.  
  1086.  
  1087.           Once you've got  that typed in, then  it's time to compile
  1088.           HLODOOR.  Using either Turbo Pascal version 6.0 or version
  1089.           7.0, compile the program to  disk.  If all goes well, then
  1090.           you'll  be  left  with  HLODOOR.EXE  on  your  hard drive.
  1091.           DDPLUS.DOC  (supplied with  DDPLUS)  includes infor-
  1092.           mation on how to configure /  run the door on your system.
  1093.           For now, let's just worry  about running the door in local
  1094.           mode.  For local mode, type  "/L" on the command line. For
  1095.           example, "HLODOOR  /L" will run  HLODOOR. Since  you are a
  1096.           local user,  the door will  prompt you for  your first and
  1097.           last name.  A remote  user's information would be gathered
  1098.           from  the  bbs information  file  (i.e.  DORINFOx.DEF). We
  1099.           won't worry about that for now.
  1100.  
  1101.  
  1102.                                ANALYSIS OF CODE
  1103.  
  1104.  
  1105.           Now lets  go through  the important  lines of  code one by
  1106.           one.
  1107.  
  1108.               LINE 3: Uses crt, DDPlus;
  1109.  
  1110.           The "uses" statement  is required by  Turbo Pascal to tell
  1111.           TP  which  units we  will  be using.   Obviously,  we need
  1112.           "DDPLUS" for DDPLUS's procedures.  "crt" is required because
  1113.           we use the DELAY procedure.
  1114.  
  1115.               LINE 6: InitDoorDriver('Game.CTL');
  1116.  
  1117.           This  is   that  all-important   initialization  statement
  1118.           described  somewhere above.   It  tells DDPLUS  to get
  1119.           things all set up and  working.  The 'GAME.CTL' is the
  1120.           name of that "control file" and we won't pay any attention
  1121.           to it for now.
  1122.  
  1123.               LINE 7: swriteln('Hello World!');
  1124.  
  1125.           This is our  screen output.  It'll  write "Hello World" to
  1126.           both the  user and the  local screen.   Since its SWRITELN
  1127.           and not SWRITE, a carriage  return and line feed also will
  1128.           be sent.  There are several ways that this could have been
  1129.           done. For example:
  1130.  
  1131.             {1}   swrite('Hello');
  1132.             {2}   swriteln(' World!');
  1133.  
  1134.               - - - or - - -
  1135.  
  1136.             {1}   swrite('Hello');
  1137.             {2}   swrite(' World!');
  1138.             {3}   swriteln('');
  1139.  
  1140.           The output will be the same in the above situations.
  1141.  
  1142.               LINE 8: Delay(5000);
  1143.  
  1144.           This routine  is provided  by Borland  and will  cause our
  1145.           program to delay  so you can see  the "hello world" before
  1146.           DDPLUS exits and clears the screen.  The string "Hello
  1147.           World!" looks pretty  plain, doesn't it?   Maybe we should
  1148.           put something a bit more impressive in, such as the user's
  1149.           name.    This   would    involve   using   the   variables
  1150.           USER_FIRST_NAME  and USER_LAST_NAME.  The  modification is
  1151.           simple enough:
  1152.  
  1153.               Change line 7 from:
  1154.  
  1155.               {7} swriteln('Hello World!');
  1156.  
  1157.               to:
  1158.  
  1159.               {7} swriteln('Hello, '+user_first_name+' '+
  1160.                   user_last_name+'!');
  1161.  
  1162.           As you may have noticed, I  used plus signs (+) instead of
  1163.           commas  (,)  to  separate  the  string  parameters  in the
  1164.           SWRITELN line.  With a standard WRITELN statement, you may
  1165.           use as many  variables as you wish,  but with SWRITELN, we
  1166.           are  limited  to  1 string  variable.   The  point  is, TP
  1167.           requires us  to merge  our string  variables together with
  1168.           the plus sign.
  1169.  
  1170.           We will now dig deeper into some interactive communication
  1171.           with the user. The best way to do this is with a sample program.
  1172.           Our last sample, HLODOOR was pretty plain, so let's write
  1173.           something that is a bit more exciting.
  1174.  
  1175.           The following is NUMDOOR.PAS: a simple little game
  1176.           designed to demonstrate some interactive communication
  1177.           with the user.
  1178.  
  1179.           { 1} program numdoor;
  1180.           { 2}
  1181.           { 3} uses ddplus;
  1182.           { 4}
  1183.           { 5} procedure DoTheTitle;
  1184.           { 6} begin;
  1185.           { 7}  sclrscr;
  1186.           { 8}  swriteln('Hello, '+user_first_name+
  1187.           { 9}          ' '+user_last_name+
  1188.           {10}          '. Welcome to NumDoor!');
  1189.           {11}  swriteln('');
  1190.           {12} end;
  1191.           {13}
  1192.           {14} procedure playgame;
  1193.           {15} var
  1194.           {16}  thenum: word;
  1195.           {17}  playerguess: word;
  1196.           {18}  guessnum: byte;
  1197.           {19}  done: boolean;
  1198.           {20}  tempstr: string;
  1199.           {21} begin;
  1200.           {22}  swriteln('I''m thinking of a number.'+
  1201.           {23}           ' Can you guess what it is?');
  1202.           {24}  swriteln('');
  1203.           {25}  guessnum:=0;
  1204.           {26}  randomize;
  1205.           {27}  thenum:=random(100)+1;
  1206.           {28}  done:=false;
  1207.           {29}  while not done do begin;
  1208.           {30}   inc(guessnum);
  1209.           {31}   swrite('Guess #');
  1210.           {32}   str(guessnum,tempstr);
  1211.           {33}   swrite(tempstr);
  1212.           {34}   swrite(': ');
  1213.           {35}   sread_num_word(playerguess);
  1214.           {36}   if playerguess>thenum then swriteln('Lower!') else
  1215.           {37}   if playerguess<thenum then swriteln('Higher!') else
  1216.           {38}    if playerguess=thenum then begin;
  1217.           {39}     swriteln('Correct!');
  1218.           {40}     done:=true;
  1219.           {41}    end;
  1220.           {42}   if guessnum=10 then done:=true;
  1221.           {43}  end; {while}
  1222.           {44}  if thenum<>playerguess then begin;
  1223.           {45}   swriteln('You Lost!');
  1224.           {46}   str(thenum,tempstr);
  1225.           {47}   swriteln('The number was '+tempstr+'.');
  1226.           {48}  end;
  1227.           {49} end;
  1228.           {50}
  1229.           {51} procedure waitforkey;
  1230.           {52} var
  1231.           {53}  ch: char;
  1232.           {54} begin;
  1233.           {55}  swriteln('');
  1234.           {56}  swriteln('Press any key to continue.');
  1235.           {57}  sread_char(ch);
  1236.           {58} end;
  1237.           {59}
  1238.           {60} begin;
  1239.           {61}  initdoordriver('GAME.CTL');
  1240.           {62}  dothetitle;
  1241.           {63}  playgame;
  1242.           {64}  waitforkey
  1243.           {65} end.
  1244.  
  1245.               Some of you were asking for a real door.. Well, there
  1246.           it is. All 62 lines worth. Those of you using our new
  1247.           LOCREAD program may wish to load up a second window on the
  1248.           screen so you may view both the above source and the rest
  1249.           of the article at the same time. On with the discussion...
  1250.  
  1251.               First lets look at an overview of the structure of
  1252.           NUMDOOR. We've got three main procedures: DoTheTitle,
  1253.           PlayGame, and WaitForKey. These procedures are pretty self
  1254.           explanatory. DoTheTitle displays a little title
  1255.           information about NUMDOOR. PlayGame performs the actual
  1256.           task of playing the game, and WaitForKey waits for the
  1257.           user to press a key once the game is over.
  1258.  
  1259.               Let's go through the program section by section. At
  1260.           the very top, you'll notice lines one and three. Line 1
  1261.           (Program NumDoor;) is simply us formally telling TP the
  1262.           name of our program. Line 2 (Uses DDPLUS;) is the
  1263.           all-important "uses" statement which tells TP that we will
  1264.           be using the DDPLUS TPU.
  1265.  
  1266.                              Procedure DoTheTitle
  1267.  
  1268.               The first procedure, DoTheTitle displays a little
  1269.           introduction to the user so he knows where he is. Let's
  1270.           look inside this procedure and see how it works:
  1271.  
  1272.               LINE 7: SCLRSCR;
  1273.  
  1274.               This is a DDPLUS procedure which we have not
  1275.           introduced before. Sclrscr is DDPLUS's compliment to
  1276.           the Turbo Pascal clrscr procedure. The clrscr procedure is
  1277.           provided by TP to allow us to clear the screen. If you're
  1278.           familiar with basic, then this is equivalent to a CLS.
  1279.           Obviously, we will need to clear both the remote and the
  1280.           local screens, so that's why we have to use DDPLUS's
  1281.           Sclrscr.
  1282.  
  1283.               LINES 8-10: SWRITELN('Hello, '+user_first_name+ .....
  1284.  
  1285.               These lines display the introduction. As we learned in
  1286.           part one of this tutorial, SWRITELN is DDPLUS's
  1287.           compliment to Turbo Pascal's writeln procedure. You may
  1288.           notice that I have separated the parameters across three
  1289.           lines. This is perfectly legal - as long as the individual
  1290.           components include plus (+) signs in between them, we can
  1291.           split it up that way.
  1292.               Another important note about this line: We include the
  1293.           variables USER_FIRST_NAME and USER_LAST_NAME. These were
  1294.           discussed in part one. For those who may have missed it,
  1295.           DDPLUS places the user's first and last names into
  1296.           those two respective variables. Sticking them in the
  1297.           SWRITELN allows us to be a bit more personal to the user.
  1298.  
  1299.               LINE 11: SWRITELN('');
  1300.  
  1301.               You may be wondering, what is the point of writing
  1302.           _nothing_ to the screen? The point is, like TP's writeln,
  1303.           swriteln will output a CR/LF sequence. So even if we do
  1304.           not write any data, the Carriage Return still goes out.
  1305.           The effect is a blank line.
  1306.  
  1307.                               Procedure PlayGame
  1308.  
  1309.               PlayGame is where all of the real work takes place.
  1310.           Let's take a minute to talk about what exactly the "game"
  1311.           is that we are playing.
  1312.               The game is a very common number guessing game. The
  1313.           computer generates a random number and the user gets ten
  1314.           shots to guess what it is. If the user guesses
  1315.           incorrectly, the computer will tell whether he needs to go
  1316.           "higher" or "lower". Now that we know what we want to do,
  1317.           lets see how we would go about doing it. In pseudocode,
  1318.           here's what we need to do:
  1319.  
  1320.               1) Generate a random number
  1321.               2) Ask the user for a guess
  1322.               3) Compare the user's guess to our random number.
  1323.               4) Say "lower", "higher", or "correct" based on the
  1324.                  outcome of #3's comparison.
  1325.               5) Loop back to 2 until either the user guesses the
  1326.                  number correctly or uses up all ten tries.
  1327.               6) If the user used up all ten tries, tell him he
  1328.                  lost.
  1329.  
  1330.               That's our strategy. Now, let's go thought the actual
  1331.           code.
  1332.  
  1333.               LINES 16-20: Variable Declarations
  1334.  
  1335.               We need a multitude of variables to store some of our
  1336.           information in. THENUM is a word variable which will hold
  1337.           the random number which we generate. PLAYERGUESS is
  1338.           another word to hold the player's current guess. GUESSNUM
  1339.           is a counter to hold how many times the user has guessed.
  1340.           DONE is a boolean to tell us when we are done. And
  1341.           finally, TEMPSTR is a temporary string which we will
  1342.           discuss when we come to it.
  1343.  
  1344.               LINES 22-24: SWRITELN('I''m thinking of .....
  1345.  
  1346.               These lines comprise a little instruction that we give
  1347.           the user. They're just simple swriteln statements, similar
  1348.           to the ones we encountered in DoTheTitle.
  1349.  
  1350.               LINE 25: GUESSNUM:=0;
  1351.  
  1352.               Since Turbo Pascal does not initialize our variables,
  1353.           we will have to do it ourselves. Guessnum is our counter
  1354.           of how many guesses the user has made. Since he hasn't
  1355.           made any yet, we've got to set it to zero.
  1356.  
  1357.               LINE 26: RANDOMIZE;
  1358.  
  1359.               The Randomize procedure is provided by Turbo Pascal to
  1360.           randomize TP's random number generator. Without it, the
  1361.           game would pick the same random number each time it runs.
  1362.  
  1363.               LINE 27: THENUM:=RANDOM(100)+1
  1364.  
  1365.               Here is where we get our random number. The random
  1366.           function returns a number between zero and it's parameter
  1367.           minus one. (i.e. Random(100) will include 0..99, not 100)
  1368.           So we add 1 to it to get numbers between 1 and 100.
  1369.  
  1370.               LINE 28: DONE:=FALSE;
  1371.  
  1372.               Right now, we aren't done yet, (we haven't even hardly
  1373.           started!) so we'd better set our variable accordingly.
  1374.  
  1375.               LINE 29: WHILE NOT DONE DO BEGIN;
  1376.  
  1377.               Line 29 sets up our "loop" which will ask the user for
  1378.           up to ten guesses. We want to keep going as long as DONE
  1379.           is not true. The loop consists of lines 29-43 which ask
  1380.           the user for his guess and check it's validity.
  1381.  
  1382.               LINE 30: INC(GUESSNUM);
  1383.  
  1384.               We're on the first guess, so set guessnum accordingly.
  1385.  
  1386.               LINES 31-34: SWRITE('Guess #' .....
  1387.  
  1388.               These lines prompt the user for his guess. Although
  1389.           they may seem complicated, they are really nothing more
  1390.           than the simple SWRITE statements that we have seen
  1391.           before. We just need to do some "magic" to manipulate our
  1392.           data.
  1393.               Let me explain our problem: SWRITE/SWRITELN only
  1394.           accept string data. But, our variable GUESSNUM is a byte
  1395.           variable which holds numeric information. So how do we get
  1396.           this data into something we can use? The answer is that we
  1397.           use Turbo Pascal's STR procedure. STR is a very handy
  1398.           procedure which converts a numeric format variable to a
  1399.           string format variable. So, when we say
  1400.           STR(GUESSNUM,TEMPSTR), we are telling pascal to "take the
  1401.           number in guessnum, convert it to a string, and place it
  1402.           in tempstr".
  1403.               Once this has been done, TEMPSTR now contains our
  1404.           number which we can send out to swrite with no problem.
  1405.  
  1406.               LINE 35: SREAD_NUM_WORD(PLAYERGUESS);
  1407.  
  1408.               This line the major new concept that we are trying to
  1409.           introduce. SREAD_NUM_WORD is a DDPLUS procedure which
  1410.           will read a word variable from the user. It handles all
  1411.           the details of waiting for the user to press keys,
  1412.           converting the data to a word, etc and just gives us a
  1413.           nice word variable.
  1414.               This is where the "interaction" takes place. Until
  1415.           now, we have just been displaying information to the user.
  1416.           Now, we ask the user for some information back.
  1417.           Specifically, we ask him for his guess. The guess is
  1418.           stored in the variable PLAYERGUESS.
  1419.  
  1420.               LINES 36-41: If playerguess>thenum then ....
  1421.  
  1422.               This block comprises the code to test the player's
  1423.           guess and act upon the results. We display "higher" or
  1424.           "lower" if the number is higher or lower and if the user's
  1425.           guess is correct, we display "correct" and set DONE to
  1426.           true to end our loop.
  1427.               This code is all standard pascal stuff (with some
  1428.           swrites thrown) in so I won't go into too much detail
  1429.           here. We've got to try to stick to the DDPLUS-related
  1430.           things or our little tutorial could get very big very
  1431.           quickly.
  1432.  
  1433.               LINE 42: IF GUESSNUM=10 THEN DONE:=TRUE;
  1434.  
  1435.               If we're at the tenth guess, then it's time to end our
  1436.           loop.
  1437.  
  1438.               LINES 44-48: IF PLAYERGUSS<>THENUM THEN BEGIN; ....
  1439.  
  1440.               We could have exited the loop for one of two reasons:
  1441.           1) The user guessed correctly and DONE was set to true or
  1442.           2) The user ran out of turns. These lines will check and
  1443.           see if the user's guess was correct. If it was not, then
  1444.           we got to break the bad news to him - he lost.
  1445.               This code also includes our little trick of using STR
  1446.           to convert the data. In this case, we have THENUM and we
  1447.           need to convert it to a string so we can tell the user
  1448.           what the number was. It works identically to the situation
  1449.           we had in lines 31-34.
  1450.  
  1451.                              Procedure WaitForKey
  1452.  
  1453.               After we have finished PlayGame, we need to have a
  1454.           little pause so the user gets to absorb the full impact of
  1455.           his game playing. We could use a simple DELAY(2000) for a
  1456.           20 second delay, but we are out to demonstrate interactive
  1457.           communication, so let's wait for a keypress.
  1458.               I'm not going into this line-by-line as it is such a
  1459.           simple procedure. Rather, I'll describe what it does.
  1460.           First, we tell the user we want him to hit a key with a
  1461.           SWRITELN statement.
  1462.               Then, we use DDPLUS's SREAD_CHAR procedure to read
  1463.           a single character. SREAD_CHAR will wait for a key and
  1464.           then return it to us. We used the variable CH to hold this
  1465.           character.
  1466.  
  1467.                               The Main Procedure
  1468.  
  1469.               The main procedure, comprising lines 60-65 executes
  1470.           all of our other procedure. Please note that similar to
  1471.           HLODOOR, we had to call INITDOORDRIVER() to get DDPLUS
  1472.           setup and ready for use.
  1473.               After that, we just called DoTheTitle, PlayGame, and
  1474.           WaitForKey in order. Then, we exit.
  1475.  
  1476.                              Interactive Routines
  1477.  
  1478.               We have introduced two new very important routines:
  1479.           SREAD_NUM_WORD and SREAD_CHAR. DDPLUS includes a whole
  1480.           set of similar routines for doing similar things. Here's a
  1481.           listing of them:
  1482.  
  1483.               SREAD(s: string);              Reads in a string
  1484.  
  1485.               SREAD_NUM(i: integer);         Reads in an integer
  1486.  
  1487.               SREAD_NUM_WORD(w: word);       Reads in a word
  1488.  
  1489.               SREAD_NUM_LONGINT(l: longint); Reads in a longint
  1490.  
  1491.               SREAD_CHAR(CH: CHAR);          Reads in a char
  1492.  
  1493.               The first four of these routines will read in data
  1494.           until the user presses the return key. For example
  1495.           "1234"<return>. They allow the user to backspace back and
  1496.           forth to correct his mistakes. These are very similar to
  1497.           Turbo Pascal's READLN and Basic's INPUT statements.
  1498.               The fifth procedure (SREAD_CHAR) will wait for a
  1499.           character and return that character. It's simply for when
  1500.           you want one character and only one character. The user
  1501.           can't correct his mistakes with backspace or anything.
  1502.           This routine also does not echo to the screen.
  1503.               SREAD_CHAR performs almost identically to Turbo
  1504.           Pascal's READKEY function. In Turbo Pascal you would use
  1505.           ch:=READKEY; With DDPLUS, use SREAD_CHAR(CH).
  1506.  
  1507.           REFERENCE - IMPORTANT THINGS
  1508.           ----------------------------
  1509.  
  1510.           -> What happens when the user runs out of time, sleep
  1511.           -> disconnects, or drops carrier?
  1512.  
  1513.           DDPLUS will HALT. This will cause an immediate
  1514.           termination of the door. If your door needs to save any
  1515.           data then you should use an EXIT PROCEDURE to save the
  1516.           data. For example:
  1517.  
  1518.           {$F+} procedure myexit; {$F-}
  1519.           begin;
  1520.            save_our_data;
  1521.            exitproc:=exitsave;
  1522.           end;
  1523.  
  1524.           {main program}
  1525.           begin;
  1526.            InitDoorDriver......
  1527.            ExitSave:=Exitproc;
  1528.            ExitProc:=@myexit;
  1529.            .......
  1530.           end.
  1531.  
  1532.           This will setup MYEXIT so it is run whenever your program
  1533.           exits for any reason. This is the best way to trapped
  1534.           carrier dropped, out of time, etc.
  1535.  
  1536.           NOTE #1: The carrier, time left, and sleep disconnect are
  1537.           only tested when DDPLUS is waiting for a keypress
  1538.           (i.e. sread_char, sread, etc)
  1539.  
  1540.           NOTE #2: If checktime=false then DDPLUS will not check
  1541.           to see if the user is out of time.
  1542.  
  1543.           -> How do you use ANSI in your programs?
  1544.  
  1545.           You can use ANSI by two methods:
  1546.  
  1547.            1) By using the set_foreground, set_background, and
  1548.               sclrscr procedures, you can perform some basic ANSI
  1549.               functions. DDPLUS will automatically enable these
  1550.               fucntions when ANSI is available and disable it when
  1551.               not.
  1552.  
  1553.            2) If you set ANSION:=TRUE, then you can just SWRITE your
  1554.               ansi sequences directly to the screen. When you turn
  1555.               ANSION on, it will slow down screen writes, so it is
  1556.               advisable to do it only when necessary.
  1557.  
  1558.  --------------------------------------------------------------------------
  1559.  This ends the copyrighted Scott Baker part of the documentation.
  1560.  The rest of this document is from Steven Lorenz and Bob Dalton.
  1561.  --------------------------------------------------------------------------
  1562.  
  1563.                         TO USE THE INITOVER.PAS UNIT
  1564.                         ---------------------------
  1565.  If your program becomes to large you can use this unit to provide automatic
  1566.  overlay initialization and setup. To use it see the partial extract of the
  1567.  following door example (main unit) for GodFather of Crime (GOC):
  1568.  
  1569.            PROGRAM World;
  1570.            {$B+}
  1571.            {$R-}
  1572.            {$S+}
  1573.            {$I+}
  1574.            {$N-}
  1575.            {$M 65520,16384,655360}
  1576.  
  1577.            Uses Overlay,    {Must be listed first!}
  1578.                 InitOver,   {Must be listed second!}
  1579.                 Dos,        {Must be listed third, if used}
  1580.                 Crt,        {Must be listed fourth, if used}
  1581.                 DDPlus,     {Must be listed next}
  1582.                 Wutil,      {your other units you are using are listed next}
  1583.                 WorldVar,
  1584.                 Wmap,
  1585.                 WStart,
  1586.                 Woption,
  1587.                 Wsave,
  1588.                 Woption2,
  1589.                 Woption3,
  1590.                 Wduel;
  1591.  
  1592.          {$O DDOvr }     {Must be shown if you are using overlays}
  1593.          {$O DDOvr2 }    {Must be shown if you are using overlays}
  1594.          {$O Wmap }      {Next comes the units you intend to overlay}
  1595.          {$O Woption }
  1596.          {$O Woption2 }
  1597.          {$O Woption3 }
  1598.          {$O Wduel }
  1599.  
  1600.          Var Dummy:PlayerRecord;
  1601.  
  1602.          etc...
  1603.  
  1604.  In each of the overlayed units you would show the following:
  1605.  
  1606.  
  1607.          UNIT Wmap;
  1608.          {$F+,O+,V-}                             {Must be exactly as shown}
  1609.          INTERFACE
  1610.          Uses Crt,WorldVar,DDPlus,Wutil;         {units used by this unit}
  1611.  
  1612.          Procedure InitGraph(VAR M: MapArray);   {your various procedures}
  1613.          Procedure ShowGraph( M: MapArray );
  1614.          Procedure InitCountry( VAR C: CountryArray );
  1615.  
  1616.          etc...
  1617.  
  1618.  Notes:
  1619.  
  1620.  1.   You cannot overlay ANY unit that makes a dos interrupt service call,
  1621.  such as CRT, MISC.PAS or INITOVER.PAS unit.
  1622.  
  1623.  2.   See the INITOVER.PAS unit for other things you will have to do.
  1624.  
  1625.                           THE MISC.PAS UNIT
  1626.                           -----------------
  1627.  The MISC.PAS unit contains the following "must have" program functions
  1628.  and procedures:
  1629.  
  1630.  FUNCTION SHAREINST - Detects if DOS SHARE is present. Returns a boolean
  1631.                        value of True or False. True if present, False if
  1632.                        not.
  1633.  
  1634.  FUNCTION FILE_EXISTS - Detects if a DOS file is present in the same 
  1635.                       directory. Returns true if it is and false if it is
  1636.                       not.
  1637.  
  1638.  PROCEDURE TERMINATE--|
  1639.  PROCEDURE TRAPEXIT---| All three of these work together to trap an exit
  1640.  PROCEDURE MYEXIT1----|  and redirect it so that an error.log is created
  1641.                          that's can tell you what happened and why. Makes
  1642.                          debugging a lot easier. Just make sure users send
  1643.                          you the error.log when they report a problem.
  1644.  
  1645.  Here is a sample of the first several lines of my main program which shows
  1646.  you how to implement some of the above:
  1647.  
  1648.  BEGIN (***  M A I N  ***)
  1649.   OvrFileMode := 64;                 {File mode for overlay units}
  1650.   ShareInst;                         {Is share installed?}
  1651.   IF ShareInst then FileMode:=66;
  1652.   SaveExitProc:=Exitproc;
  1653.   ExitProc:=@MyExit1;
  1654.   RANDSEED:=(TICKCOUNT);             {Good way to randomize a number}
  1655.   GetDate(Year,Month,Day,DOW);
  1656.   INITDOORDRIVER('GOC.CTL');
  1657.   PROGNAME:='GODFATHER OF CRIME by Bob Dalton';
  1658.   NOTIME:='*** TIME HAS EXPIRED ***';
  1659.   If Graphics < 3 Then
  1660.   Begin
  1661.     Wn('The game requires ANSI or RIP color and graphics.');
  1662.     Wn('Your current parameters do not qualify you for either.');
  1663.     Wn('To play this game, go back to the BBS and select the ANSI');
  1664.     Wn('or RIP graphics option usually found in the Utilities Menus.');
  1665.     Crlf;Wn('ASK YOUR SYSOP IF YOU HAVE FURTHER PROBLEMS!');
  1666.     Crlf;
  1667.     Crlf;
  1668.     Wn('Sending you back to the BBS.....');
  1669.     Delay(2500);
  1670.     Crlf;
  1671.     Exit
  1672.    End;
  1673.   TC(10);
  1674.   Clr;
  1675.   DisplayFile('GOCOPEN.ANS');
  1676.   Delay(3000);
  1677.   Assign(GenFile,'GEN.DAT');
  1678.   IF ShareInst then FileMode:=64;
  1679.   IF FILE_EXISTS('GEN.DAT') THEN
  1680.    Begin
  1681.     OpenAttempts:=1;
  1682.     Repeat
  1683.      {$I-}
  1684.      Reset(GenFile);
  1685.      {$I+}
  1686.      GoAhead:= (IOResult = 0);
  1687.      If Not GoAhead then OpenAttempts :=OpenAttempts+1;
  1688.     Until (GoAhead) or (OpenAttempts>15);
  1689.    End;
  1690.   Read(GenFile,General);                            
  1691.   Close(GenFile);                                   
  1692.   IF ShareInst then FileMode:=66;                                        
  1693.  
  1694.    etc....
  1695.  
  1696.           TO USE FILE LOCKING AND SHARING (QUICK & SIMPLE METHOD)
  1697.           -------------------------------------------------------
  1698.  If you want to design multi-node capable games/programs then you must
  1699.  use the services of DOS SHARE to perform file locking and sharing.
  1700.  Below is a simple method, with example, of how this can be done.
  1701.  Use FILEMODE=64 to lock files to prevent changes while you are working
  1702.  on it/them.  Use FILEMODE=66 as a general rule to tell SHARE to allow
  1703.  other programs to READ/WRITE files at the same time. Use something like
  1704.  the following section of code to lock/unlock files:
  1705.  
  1706.   Assign(GenFile,'GEN.DAT');
  1707.   IF ShareInst then FileMode:=64;  {Tells to lock next file operation}
  1708.   IF FILE_EXISTS('GEN.DAT') THEN   {Uses function to see if file present}
  1709.    Begin
  1710.     OpenAttempts:=1;               {Begin counter in case file in use}
  1711.     Repeat
  1712.      {$I-}
  1713.      Reset(GenFile);               {Attempts to Reset File for reading}
  1714.      {$I+}
  1715.      GoAhead:= (IOResult = 0);     {Did we get a goahead?}
  1716.      If Not GoAhead then OpenAttempts :=OpenAttempts+1;  {If not then loop}
  1717.     Until (GoAhead) or (OpenAttempts>15);  {Until we do or 15 times}
  1718.    End;
  1719.   Read(GenFile,General);           {Read that file}
  1720.   Close(GenFile);                  {Close the file}
  1721.   IF ShareInst then FileMode:=66;  {After done unlocks file for whatever}
  1722.                                    
  1723.                               CREDITS:
  1724.                               --------
  1725.  This relatively small section is just to recognize the people who have made
  1726.  the DDPLUS package a possibility.
  1727.  
  1728.  Scott Baker       -=*=-  The authors of the original DoorDriver Kit
  1729.  and                       are to be thanked for releasing the
  1730.  Derrick Parkhurst         source code to their great kit!  Without
  1731.                            that act of kindness DDPLUS would NOT
  1732.                            be possible.  Hopefully Steve and I
  1733.                            have done your kit justice and given it
  1734.                            a new lease on life in the programming
  1735.                            world. Scott is the author of several
  1736.                            door games, most notably Land of Devastation,
  1737.                            which uses the original doordriver kit.
  1738.  
  1739.  Steven Lorenz      -=*=- The author of the enhanced add on package
  1740.                            to Scott Bakers DoorDriver Kit. Thanks to
  1741.                            his code modifications, add ons and enhancements
  1742.                            DDPLus is a much more complete and capable
  1743.                            package then originally released in the
  1744.                            DoorDriver Kit. He is also responsible for
  1745.                            the DDPlus setup program which he freely donated.
  1746.                            Steve is the author of several door games, most
  1747.                            notably Railroad Empires, Romans At War, and
  1748.                            Empires at War, all of which use DDPlus.
  1749.  
  1750.  Bob Dalton         -=*=- The author of most of the documentation in this
  1751.                            package and contributor of the MISC.PAS and
  1752.                            INITOVER.PAS units. Bob is the author of several
  1753.                            door games, such as GodFather of Crime, Rise To
  1754.                            Power, Task Force Broadside, Ship of the Line,
  1755.                            Grunt Fest, Way Freight and the Adventure Door
  1756.                            Game Toolkit, all of which use DDPLus.
  1757.  
  1758.  DESQview is a registered trademark of Quarterdeck Office Systems.
  1759.  Ripscript & Ripterm are registered trademarks of TeleGrafix Communications.
  1760.  
  1761.                            Where to reach us
  1762.                            -----------------
  1763.  
  1764.  We can usually be reached at the following places:      
  1765.  
  1766.  Steven Lorenz - The Officer Club BBS - Telephone Number: 818-248-9487 (CA)
  1767.  
  1768.  Bob Dalton    - The TANSTAFL BBS - Telephone Number: 501-741-5699 (AR).
  1769.                  FIDO Node Number: 1:391/3010
  1770.  
  1771.  Scott Baker   - Although he NO longer supports his original DoorDriver
  1772.                   kit I am sure he would appreciate any free program you
  1773.                   were to offer him. He can be reached at his Not Yet Named
  1774.                   BBS at 602-544-4655 (AZ) or FIDO Node Number 1:300/9. Keep
  1775.                   in mind he will NOT answer any questions about this kit!
  1776.  
  1777.  NOTE:  Both Steve Lorenz and Bob Dalton habitually monitor the FIDO door
  1778.          related National and International echos if you have questions.
  1779.  
  1780.                    Bug Reports/Comments/Suggestions
  1781.                    --------------------------------
  1782.  We have made every attempt to make sure this package is free of bugs, BUT
  1783.  the possibility always exists that one may have been missed by us. 
  1784.  If you find a bug, or have a suggestion or comment to make which would make
  1785.  future versions of DDPlus even better, then netmail Bob Dalton or post a
  1786.  message on one of our BBS's. We do read ALL of them and those people that
  1787.  lead us to find a bug or generate a better package will receive credit in
  1788.  the next DDPlus version published. PLEASE DO NOT NOTIFY US OF PROBLEMS AND
  1789.  EXPECT US TO FIX THEM IF YOU HAVE FAILED TO PROVIDE US WITH COMPLETE
  1790.  INFORMATION ON THE PROBLEM!  
  1791.  
  1792.                           FIDO INFORMATION
  1793.                           ----------------
  1794.  Bob Dalton's BBS supports file "freq"ing at 9600 baud or above. Just call
  1795.  1:391/3010. He also carries a door library of over 350 of the all time best
  1796.  door games which he tries to keep current.  For a list of these doors just
  1797.  freq "DOORS". We are always adding new things to DDPlus so most likely
  1798.  there will be a later version of the program available on one of our BBS's
  1799.  then the one you have. For a current version of DDPLUS you can call
  1800.  either Steve's or Bob's BBS and download it, or if you are a member of
  1801.  the FIDO network and have a 9600 baud or above modem you can freq the
  1802.  magic name "DDPLUS" for the latest version.  Bob Dalton carries a large
  1803.  Turbo Pascal support file section. If you would like a list of these files
  1804.  just freq "FILES" from him. If you are a door game/program writer
  1805.  why not send Bob or Steve a copy of your game/program?  If you have a more
  1806.  current version of a door then we have, please consider sending us a copy
  1807.  as a token of your appreciation for the service we offer at NO cost to you.
  1808.  Thanks!