home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / DESIRE15.ZIP / INSTALL.DAT / DOORINFO.DOC < prev    next >
Text File  |  1997-02-11  |  19KB  |  414 lines

  1.  ·─·                    ·───────────────────────·                      ·─·
  2.    How to learn to write a door using Borland Pascal 7.0tm & the doorkit!
  3.  ·───────────────────────────────────────────────────────────────────────·
  4.       ▓   ▄▄██▄                   ▄██▄▄   ▓                 ░
  5.       ▄▄████▓███▄               ▄▓████▓██▄▄                 ▒         
  6.       ▄▄██████▓█▓▓███▓▄           ▄▓▓▓▓█▓█▓█▓▓███▄▄             ▓         
  7.    ▄██████▓█▓▓▓▓▓▓▓▓▓▓▓▓▄   ░   ▄▓▓▒▓▓▒▓▒▓▓▓▓▓▓█████▀           ▓
  8.     ▀▀██▓▒▓▓▒▓▒▒▓▒▒▓▒▓▓▓▓▒▄ ▒ ▄▓▓▓▒▒▓▓▒▓▒▓▒░▒▒░▓▀▀              █
  9.     ▀▀▒░▒▒▒░▒▒░▓▒▒▒▒▒░▓▓▄▓▓▓▒▓▒░▒▓░▒░▒░░▀▀▓                 █         
  10.       ▒ ▀▀░░░▒░░▒░▒░░░▒▓▓▓▒▓░▒░░▒░█░▀▀    ▒          ░      █
  11.       ░     ▀██░░░░░░░░▒░▒░▒░░░░░▀        ▒          ░      ▓         
  12.     ░         ▄▄░░░░░░░░░░░░█░░░░░░░▒▓▒▄      ░          ▒      ▒         
  13.     ▒     ▄▄░░▒░░▒▒░░▒░░░▒░░░░░░░░░░▒▓▓█▒░▄▄             ▒      ▒         
  14.     ▓ ▄▄▒▒▒░░▒▒░▒▒▓▒░▓▒▒░▒▒▀▓▀▒░▒▒░▒▒▒▓█▓▒█▒██▄▄         ▓      ░         
  15.    ▄█▓▓▓█▓▒▒▒▒▓▒▓▓█▓▒█▓▓▒▀  ▒  ▀▓▓▒▓▓▓██▓▓▓▓██████▄▄     ▓                
  16.     ▀▀████▓▓▓▓█▒▓███▓██▀ ▓  ▒    ▀▓▓▓████▓█▓█████████▄ ▄ ▓                
  17.     █ ▄ ▀▀██▓▓█▓█▓███▀▄▄█▓████▄▄  ▄▀█████▓████████▀▀    ▄▐▌▄   ▓          
  18.     █ ▐███▄▄▀▀█████▀▄▌███▓████████▐█▄▀████████▀▀▄▄██████▄▀▀▄███▓███▄▄     
  19.     ▓ ▐██████▌▄▄▀▀▄███▐███████████▌███▄▀██▀▀▄▄████████████▐████▓███████▄▄ 
  20.     ▒ ▐██████ ███████▌▐███████████▌█████▄▄█████▄▐████▓████▌█████████████▌ 
  21.     ▒  ██▓███▌▐█████▀▄█████████████▐███████████▌█████▓█████▐███▌████████  
  22.     ░  ██▓████████▄▄█▐█████████████▐███▌███████▐█████▓█████▐████▐██████▌  
  23.        ▐█▓███████████▌██████▌██████▐███▌██████▌██████▌█████▌████▌██████
  24.     ██████▀███████▐█████ ▐█████▌███████████▐█████▐█████▌█████▄▄▀▀█▌
  25.        ▐███████▐██████▐█████ ██████▌███▐███████▌█████▌█████▌█████████▄
  26.        ████████▐█████▌██████ ██████▐██▌████▓████▐████▌█████▐██████████▌
  27.       ▐████████▐██████▐█████ ██████▌███▐███▓███▌█████▌█████▌███████████
  28.       █████████▐█████▌██████ ██████▐██▌████▓████▐██████████▀▄▄▀████████▌  
  29.       █████████▐█████▌██████ ██████▐██▌█████████▌█████████▌████▄▀███████  
  30.       ▐████▓███▐█▓███ ██████▌██████▐███▐████████▐██████████▐███████████▌  
  31.        ████▓██▀ ▀▓███ █████████▓██▌████▌███▓███▌██████████▌████████████   
  32.        ▐█▀ ▓       ▀█ ▐█████▓██▓█▀▄███▀ ■ ▀▓███▐▓███████▀▄██████▓███▀▀    
  33.        ▐                ▀▀ ▀▓▀ ▓ ▀▀▀         ▀  ▓ ▀▀▀▀  ███████▀▓         
  34.                 ▓                          ▐██▀▀    ▓
  35.                             █  - SQUiZZY -
  36.                              ▀                
  37.  
  38. ╙─────────────────────────────────────────────────────────────────────────·
  39.  │ 1.                       Introduction                                 │
  40. ·┘───────────────────────────────────────────────────────────────────────└·
  41.  
  42.    This document is for those people who want to start coding but didn't
  43.    know where to start... If you have Borland Pascal 7.0 you can use this!
  44.  
  45.    This is the first issue of the DOORINFO.DOC, If people find it usefull
  46.    we will continue to write more documents on developing doors and utils.
  47.  
  48.    If you have any suggestions/comments regarding this document, contact
  49.    us. (See below!)
  50.  
  51. ╙─────────────────────────────────────────────────────────────────────────·
  52.  │ 2.                     'DOOR' - Basics                                │
  53. ·┘───────────────────────────────────────────────────────────────────────└·
  54.  
  55.   Pascal is a Programming Language which is still very popular and very 
  56.   usefull to learn people the basics of how to code doors & utils. To 
  57.   code doors you need a 'DOORKIT'. A doorkit is a piece of software
  58.   which basicly handles the communication with the modem.
  59.  
  60.   A DOOR is a piece of software which is being executed from the dESiRE
  61.   boardsystem. When it is executed it takes over dESiRE and the
  62.   communication with the modem. A door could, for instance, show the
  63.   last 10 callers of the board. After the door is ready it returns dESiRE
  64.   and the modem to the system and quits. The dESiRE takes over the
  65.   modem again and continues were it left.
  66.  
  67.   In order to work properly the DOOR needs to get all necessary data of
  68.   a certain user online (e.g. Name,Location, Time left on the system, etc.)
  69.   This is done by dESiRE by writing a file to disk which the DOOR can
  70.   take over. This file is called the 'DROPFILE'. If this door needs to
  71.   change data which much take effect instantly, he changes the DROPFILE
  72.   which is in the memory and just before returning to dESiRE he needs
  73.   to write it back to disk.
  74.  
  75.   When returning to dESiRE this DROPFILE, when changed, is taken over from
  76.   the DOOR to let all changes take effect immediately.
  77.  
  78.   In case of a LASTCALL-door this dropfile will not be changed because,
  79.   in most cases, this door only shows something to the user but does
  80.   not need any input. In case of a ANSI-selector at login (a DOOR which
  81.   ask a user online wheter to use ANSI Colors or ASCII grey) you need
  82.   to change the DROPFILE when door is finished, otherwise dESiRE will 
  83.   not notice any changes in the ANSI/ASCII setup of the user.
  84.  
  85.   Whit a DOORKIT you are able to make doors...
  86.  
  87. ╙─────────────────────────────────────────────────────────────────────────·
  88.  │ 3.                     Pascal - Basics                                │
  89. ·┘───────────────────────────────────────────────────────────────────────└·
  90.  
  91.   A simple (Borland-standard) Pascal program is of the form:
  92.  
  93.   ------------------------------------------------------------------------
  94.   1 Program NAME;
  95.   2
  96.   3 Uses ............;
  97.   4
  98.   5 Begin
  99.   6 End.
  100.   ------------------------------------------------------------------------
  101.  
  102.   The NAME can be any name you like although you should be carefull in
  103.   using numbers and certain special characters. Every block of code
  104.   begins with a 'BEGIN'-statement and ends with an 'END'-statement!
  105.  
  106.   After the Uses-statement all necessary pieces of software (libraries) 
  107.   needed for this program are listed. If we want to make a door the DOORKIT 
  108.   should be listed there. In many cases you need the CRT and DOS libraries.
  109.   These are pieces of software with special commands.
  110.  
  111.   So line 3 should be something like this:
  112.  
  113.   ------------------------------------------------------------------------
  114.   3 Uses Doorkit,Crt,Dos;
  115.   ------------------------------------------------------------------------
  116.  
  117.   The DOORKIT consists of several commands to be used with dESiRE. For
  118.   instance, if you want to write a sentence to the user online you need
  119.   the 'AllWrite'-command. For instance:
  120.  
  121.  
  122.   ------------------------------------------------------------------------
  123.   1 Program NAME;
  124.   2
  125.   3 Uses Doorkit,Crt,Dos;
  126.   4
  127.   5 Begin
  128.   6 AllWrite('Hello user!');
  129.   7 End.
  130.   ------------------------------------------------------------------------
  131.  
  132.   This would write 'Hello user!' to the user online.
  133.   But before you can use this code to make a door you need to add some
  134.   lines to make the DOORKIT work properly!
  135.  
  136.   Just before the last 'End'-statement you need to add the line:
  137.  
  138.   ------------------------------------------------------------------------
  139.   CloseAll;
  140.   ------------------------------------------------------------------------
  141.  
  142.   Now the DOORKIT knows it has to return the modem to dESiRE and releases
  143.   all used memory to the system.
  144.  
  145.   So our DOOR will be:
  146.  
  147.   ------------------------------------------------------------------------
  148.   1 Program NAME;
  149.   2
  150.   3 Uses Doorkit,Crt,Dos;
  151.   4
  152.   5 Begin
  153.   6 AllWrite('Hello user!');
  154.   7 CloseAll;
  155.   8 End.
  156.   ------------------------------------------------------------------------
  157.  
  158.   This is the most simple door you can write.
  159.  
  160. ╙─────────────────────────────────────────────────────────────────────────·
  161.  │ 4.                    Using the DROPFILE data                         │
  162. ·┘───────────────────────────────────────────────────────────────────────└·
  163.  
  164.   Now we want to use the DROPFILE data such as the name of the user and
  165.   his location. All USERDATA of the user online is stored in the DROPFILE
  166.   which is in the memory when you use the DOORKIT. You can access this
  167.   data by using an object with the name 'DOOR'.
  168.  
  169.   'DOOR' is a RECORD, which means it consist of several types of data. It
  170.   consists of
  171.    - 'STRING'-types.        a STRING constist of a set of characters like
  172.                             in 'Hello User!' Normally a STRING contains
  173.                             255 characters but if you need less than that
  174.                             STRING[x] uses only x characters where x is
  175.                             a number between 1 and 255.
  176.    - 'INTEGER'-types.       this is a number. In an 'INTEGER' you can put
  177.                             numbers between -32768 and 32767.
  178.    - 'LONGINT'-types.       this is a number. In an 'LONGINT' you can put
  179.                             numbers between -2147483648 and 2147483647
  180.    - 'DOUBLE'-types.        this is a number. In an 'DOUBLE' you can put
  181.                             numbers from 5.0E-324 to 1.7E308. Instead of
  182.                             the INTEGER and LONGINT type this DOUBLE is
  183.                             floating point! for example:
  184.                             A double can be 2 or 2.1 or 2.2 or 2.000001.
  185.                             A INTEGER or LONGINT can only be 1,2 or 3 etc.
  186.                             but nothing in between.
  187.    - 'BYTE'-types.          number between 0..255
  188.    - 'BOOLEAN'-types.       This can either be 'FALSE' or 'TRUE'.
  189.  
  190.    - 'ARRAY'-types.         An array consist of a whole set of types.
  191.                             For instance:
  192.                             ----------------------------------------------
  193.                             Array [1..10] of Byte;
  194.                             ----------------------------------------------
  195.                             Contains 10 bytes after each other.
  196.  
  197.   the 'DOOR'-record in memory consist of the following types:
  198.  
  199.   ------------------------------------------------------------------------
  200.  
  201. TYPE
  202.         ConfigRec = RECORD                        { C:\DESIRE\CONFIG.<Node> }
  203.  
  204.         BBSName         :       String[30];
  205.         Sysop           :       String[30];
  206.         Located         :       String[50];
  207.  
  208.         Path            :       String[60];
  209.         Data            :       String[60];
  210.         Commands        :       String[60];
  211.         FileToMsg       :       String[60];
  212.         Work            :       String[60];
  213.         Hold            :       String[60];
  214.         LcFiles         :       String[60];
  215.         Node            :       String[60];
  216.         Access          :       String[60];
  217.         Broken          :       String[60];
  218.         LogFiles        :       String[60];
  219.         Scripts         :       String[60];
  220.  
  221.         Irq             :       Byte;
  222.         ComVector       :       String[3];
  223.         BaseAddr        :       String[5];
  224.         ComType         :       Byte;
  225.         Comport         :       Byte;
  226.         Baudrate        :       LongInt;
  227.         Parity          :       Char;
  228.         CharLength      :       Byte;
  229.         StopBits        :       Byte;
  230.  
  231.         Inittries       :       Byte;
  232.         InitString      :       String[60];
  233.         OKstring        :       String[10];
  234.         HangUpString    :       String[60];
  235.         BusyString      :       String[10];
  236.         AnswerString    :       String[60];
  237.         RingString      :       String[10];
  238.         OffHookString   :       String[60];
  239.  
  240.         NotUsed1        :       Array[1..315] of Byte;
  241.  
  242.         SystemPwd1      :       String[15];
  243.         SystemPwd2      :       String[15];
  244.         NewUserPwd1     :       String[15];
  245.         NewUserPwd2     :       String[15];
  246.         VipPreset       :       Byte;
  247.                                 { IF Nup2 then what preset to give }
  248.  
  249.         PwdTries        :       Array[1..8] of Byte;
  250.                                 { 1 = System   Password #1 Attempts }
  251.                                 { 2 = System   Password #2 Attempts }
  252.                                 { 3 = User     Password Attempts }
  253.                                 { 4 = Newuser  Password Attempts }
  254.                                 { 5 = Conf.    Password Attempts }
  255.                                 { 6 = Command  Password Attempts }
  256.                                 { 7 = Door     Password Attempts }
  257.                                 { 8 = Baudrate Password Attempts }
  258.  
  259.         AskFront            :   Boolean;
  260.                                 { Ask system pwd before welcome screen ? }
  261.  
  262.         FlashAtRing         :   Boolean;
  263.         BeepAtRing          :   Boolean;
  264.         FlashAtPage         :   Boolean;
  265.         AskChatReason       :   Boolean;
  266.         AskMailScan         :   Boolean;
  267.         AskDeleteMessage    :   Boolean;
  268.         SystemxDropFile     :   Boolean;
  269.  
  270.         HowManyNodes        :   Byte;
  271.         MinPwLength         :   Byte;
  272.         ScreenSave          :   Boolean;
  273.         ScrSaveSecs         :   Integer;
  274.         LocalOffHook        :   Boolean;
  275.  
  276.         WeekTopReset        :   Byte;
  277.  
  278.         ForeColor           :   Byte;
  279.         BackColor           :   Byte;
  280.         BlinkColor          :   Byte;
  281.         MinSpace            :   Longint;
  282.         MonoMode            :   Boolean;
  283.         AnswerMachine       :   Boolean;
  284.         AnswerComment       :   Boolean;
  285.         RelativeConfs       :   Boolean;
  286.         FullyPrivate        :   Boolean;
  287.         NoSysopCalls        :   Boolean;
  288.         FileUpCase          :   Boolean;
  289.         AskLanguage         :   Boolean;
  290.         AskAnsiGraphics     :   Boolean;
  291.  
  292.         PageBeep            :   Boolean;
  293.         PageComment         :   Boolean;
  294.  
  295.         Nu_Hidden           :   Boolean;
  296.         Nu_AutoMsg          :   Boolean;
  297.         Nu_HangUp           :   Boolean;
  298.         Nu_Preset           :   Byte;
  299.  
  300.         Presets_SecLvl      :   Array[1..5] of Byte;
  301.         Presets_TimeDay     :   Array[1..5] of Longint;
  302.         Presets_ChatDay     :   Array[1..5] of Longint;
  303.         Presets_Bytes       :   Array[1..5] of Longint;
  304.         Presets_ConfACP     :   Array[1..5] of String[3];
  305.         Presets_ConfAcc     :   Array[1..5] of Boolean;
  306.         Presets_Ratio       :   Array[1..5] of Byte;
  307.         Presets_RatioType   :   Array[1..5] of Byte;
  308.         Presets_Flags       :   Array[1..5,1..99] of Boolean;
  309.         Presets_Limits      :   Array[1..5,1..30] of Byte;
  310.  
  311.         Macros1             :   Array[1..10] of String[65];
  312.         Macros2             :   Array[1..10] of String[65];
  313.  
  314.         NotUsed3            :   Array[1..406] of Byte;
  315.  
  316.         ProtoKey            :   Array[1..10] of String[1];
  317.         ProtoName           :   Array[1..10] of String[30];
  318.         ProtoULBat          :   Array[1..10] of String[8];
  319.         ProtoDLBat          :   Array[1..10] of String[8];
  320.  
  321.         MenuSetName         :   Array[1..5] of String[30];
  322.         MenuSetPath         :   Array[1..5] of String[60];
  323.         MenuSetDoors        :   Array[1..5] of String[60];
  324.  
  325.         FutureExpand1       :   Boolean;
  326.  
  327.         AskGoodbye          :   Boolean;
  328.         FileListClrScr      :   Boolean;
  329.  
  330.         Mode80x25           :   Boolean;
  331.         Mode80x30           :   Boolean;
  332.         Mode80x34           :   Boolean;
  333.         Mode80x43           :   Boolean;
  334.         Mode80x50           :   Boolean;
  335.         Mode80x60           :   Boolean;
  336.  
  337.         PwdFillChar1        :   Char;   { systempasswords }
  338.         PwdFillChar2        :   Char;   { userpassword }
  339.  
  340.         HandleFaxConnects   :   Boolean;
  341.         SkipNewUserApply    :   Boolean;
  342.         DisableMouse        :   Boolean;
  343.         UseCdPlayer         :   Boolean;
  344.         NodeRefresh         :   Boolean;
  345.         LocalWarningIfRing  :   Boolean;
  346.         DontCloseComport    :   Boolean;
  347.  
  348.         FutureOptions       :   Array[1..4668] of Byte;
  349.  
  350.         end;
  351.  
  352.   ------------------------------------------------------------------------
  353.  
  354.   The texts between '{' and '}' or '(*' and '*)' are comments and do not
  355.   mean anything!
  356.  
  357.   If, for instance, you want to write some user information to the user
  358.   online you can use 'AllWrite' to show it. But 'AllWrite' only is
  359.   able to show 'STRING'-types. In order to be able to show numbers to
  360.   you need to convert numbers to a string.
  361.  
  362.   For instance, when Number is a number of 'LONGINT'-type:
  363.   ------------------------------------------------------------------------
  364.   AllWriteln(LongToStr(Number,0));
  365.   ------------------------------------------------------------------------
  366.   This would print the number 'Number' in no particular size.
  367.  
  368.   ------------------------------------------------------------------------
  369.   AllWriteln(LongToStr(Number,8));
  370.   ------------------------------------------------------------------------
  371.   This would print the number 'Number' using exactly 8 characters whether
  372.   the number fits in it or not.
  373.  
  374.   If you want to show data from the DOOR-record you need to use:
  375.   DOOR.xxxxxx, where xxxxxx is the name of the datafield.
  376.  
  377.   If you want to show the user's name you do this:
  378.   ------------------------------------------------------------------------
  379.   AllWriteln(Door.Name);
  380.   ------------------------------------------------------------------------
  381.  
  382.   If you want to show the user's location you do this:
  383.   ------------------------------------------------------------------------
  384.   AllWriteln(Door.Location);
  385.   ------------------------------------------------------------------------
  386.  
  387.   If you want to show the user's securitylevel you do this:
  388.   ------------------------------------------------------------------------
  389.   AllWriteln(IntToStr(Door.SecLvl,0));
  390.   ------------------------------------------------------------------------
  391.   Notice the use of 'IntToStr' to convert this 'BYTE'-type number to
  392.   a string. (the Security level is a number between 0 and 255)
  393.  
  394. ╙─────────────────────────────────────────────────────────────────────────·
  395.  │ 5.                      How to contact xROADs                         │
  396. ·┘───────────────────────────────────────────────────────────────────────└·
  397.  
  398.                              Eternal Damnation      
  399.  
  400.                                +31-765-600721
  401.   
  402.                              Or E-mail us at
  403.  
  404.                               xroads@stack.nl
  405.  
  406.                          Or visit the webpage at
  407.  
  408.                           www.stack.nl/~xroads
  409.  
  410.                      Or join #XROADS or #DESIRE on Efnet
  411.  
  412. ╙─────────────────────────────────────────────────────────────────────────·
  413.  
  414.