home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
MISC
/
DESIRE15.ZIP
/
INSTALL.DAT
/
INFO.ZIP
/
DOORINFO.DOC
< prev
next >
Wrap
Text File
|
1997-02-11
|
19KB
|
414 lines
·─· ·───────────────────────· ·─·
How to learn to write a door using Borland Pascal 7.0tm & the doorkit!
·───────────────────────────────────────────────────────────────────────·
▓ ▄▄██▄ ▄██▄▄ ▓ ░
▄▄████▓███▄ ▄▓████▓██▄▄ ▒
▄▄██████▓█▓▓███▓▄ ▄▓▓▓▓█▓█▓█▓▓███▄▄ ▓
▄██████▓█▓▓▓▓▓▓▓▓▓▓▓▓▄ ░ ▄▓▓▒▓▓▒▓▒▓▓▓▓▓▓█████▀ ▓
▀▀██▓▒▓▓▒▓▒▒▓▒▒▓▒▓▓▓▓▒▄ ▒ ▄▓▓▓▒▒▓▓▒▓▒▓▒░▒▒░▓▀▀ █
▀▀▒░▒▒▒░▒▒░▓▒▒▒▒▒░▓▓▄▓▓▓▒▓▒░▒▓░▒░▒░░▀▀▓ █
▒ ▀▀░░░▒░░▒░▒░░░▒▓▓▓▒▓░▒░░▒░█░▀▀ ▒ ░ █
░ ▀██░░░░░░░░▒░▒░▒░░░░░▀ ▒ ░ ▓
░ ▄▄░░░░░░░░░░░░█░░░░░░░▒▓▒▄ ░ ▒ ▒
▒ ▄▄░░▒░░▒▒░░▒░░░▒░░░░░░░░░░▒▓▓█▒░▄▄ ▒ ▒
▓ ▄▄▒▒▒░░▒▒░▒▒▓▒░▓▒▒░▒▒▀▓▀▒░▒▒░▒▒▒▓█▓▒█▒██▄▄ ▓ ░
▄█▓▓▓█▓▒▒▒▒▓▒▓▓█▓▒█▓▓▒▀ ▒ ▀▓▓▒▓▓▓██▓▓▓▓██████▄▄ ▓
▀▀████▓▓▓▓█▒▓███▓██▀ ▓ ▒ ▀▓▓▓████▓█▓█████████▄ ▄ ▓
█ ▄ ▀▀██▓▓█▓█▓███▀▄▄█▓████▄▄ ▄▀█████▓████████▀▀ ▄▐▌▄ ▓
█ ▐███▄▄▀▀█████▀▄▌███▓████████▐█▄▀████████▀▀▄▄██████▄▀▀▄███▓███▄▄
▓ ▐██████▌▄▄▀▀▄███▐███████████▌███▄▀██▀▀▄▄████████████▐████▓███████▄▄
▒ ▐██████ ███████▌▐███████████▌█████▄▄█████▄▐████▓████▌█████████████▌
▒ ██▓███▌▐█████▀▄█████████████▐███████████▌█████▓█████▐███▌████████
░ ██▓████████▄▄█▐█████████████▐███▌███████▐█████▓█████▐████▐██████▌
▐█▓███████████▌██████▌██████▐███▌██████▌██████▌█████▌████▌██████
██████▀███████▐█████ ▐█████▌███████████▐█████▐█████▌█████▄▄▀▀█▌
▐███████▐██████▐█████ ██████▌███▐███████▌█████▌█████▌█████████▄
████████▐█████▌██████ ██████▐██▌████▓████▐████▌█████▐██████████▌
▐████████▐██████▐█████ ██████▌███▐███▓███▌█████▌█████▌███████████
█████████▐█████▌██████ ██████▐██▌████▓████▐██████████▀▄▄▀████████▌
█████████▐█████▌██████ ██████▐██▌█████████▌█████████▌████▄▀███████
▐████▓███▐█▓███ ██████▌██████▐███▐████████▐██████████▐███████████▌
████▓██▀ ▀▓███ █████████▓██▌████▌███▓███▌██████████▌████████████
▐█▀ ▓ ▀█ ▐█████▓██▓█▀▄███▀ ■ ▀▓███▐▓███████▀▄██████▓███▀▀
▐ ▀▀ ▀▓▀ ▓ ▀▀▀ ▀ ▓ ▀▀▀▀ ███████▀▓
▓ ▐██▀▀ ▓
█ - SQUiZZY -
▀
╙─────────────────────────────────────────────────────────────────────────·
│ 1. Introduction │
·┘───────────────────────────────────────────────────────────────────────└·
This document is for those people who want to start coding but didn't
know where to start... If you have Borland Pascal 7.0 you can use this!
This is the first issue of the DOORINFO.DOC, If people find it usefull
we will continue to write more documents on developing doors and utils.
If you have any suggestions/comments regarding this document, contact
us. (See below!)
╙─────────────────────────────────────────────────────────────────────────·
│ 2. 'DOOR' - Basics │
·┘───────────────────────────────────────────────────────────────────────└·
Pascal is a Programming Language which is still very popular and very
usefull to learn people the basics of how to code doors & utils. To
code doors you need a 'DOORKIT'. A doorkit is a piece of software
which basicly handles the communication with the modem.
A DOOR is a piece of software which is being executed from the dESiRE
boardsystem. When it is executed it takes over dESiRE and the
communication with the modem. A door could, for instance, show the
last 10 callers of the board. After the door is ready it returns dESiRE
and the modem to the system and quits. The dESiRE takes over the
modem again and continues were it left.
In order to work properly the DOOR needs to get all necessary data of
a certain user online (e.g. Name,Location, Time left on the system, etc.)
This is done by dESiRE by writing a file to disk which the DOOR can
take over. This file is called the 'DROPFILE'. If this door needs to
change data which much take effect instantly, he changes the DROPFILE
which is in the memory and just before returning to dESiRE he needs
to write it back to disk.
When returning to dESiRE this DROPFILE, when changed, is taken over from
the DOOR to let all changes take effect immediately.
In case of a LASTCALL-door this dropfile will not be changed because,
in most cases, this door only shows something to the user but does
not need any input. In case of a ANSI-selector at login (a DOOR which
ask a user online wheter to use ANSI Colors or ASCII grey) you need
to change the DROPFILE when door is finished, otherwise dESiRE will
not notice any changes in the ANSI/ASCII setup of the user.
Whit a DOORKIT you are able to make doors...
╙─────────────────────────────────────────────────────────────────────────·
│ 3. Pascal - Basics │
·┘───────────────────────────────────────────────────────────────────────└·
A simple (Borland-standard) Pascal program is of the form:
------------------------------------------------------------------------
1 Program NAME;
2
3 Uses ............;
4
5 Begin
6 End.
------------------------------------------------------------------------
The NAME can be any name you like although you should be carefull in
using numbers and certain special characters. Every block of code
begins with a 'BEGIN'-statement and ends with an 'END'-statement!
After the Uses-statement all necessary pieces of software (libraries)
needed for this program are listed. If we want to make a door the DOORKIT
should be listed there. In many cases you need the CRT and DOS libraries.
These are pieces of software with special commands.
So line 3 should be something like this:
------------------------------------------------------------------------
3 Uses Doorkit,Crt,Dos;
------------------------------------------------------------------------
The DOORKIT consists of several commands to be used with dESiRE. For
instance, if you want to write a sentence to the user online you need
the 'AllWrite'-command. For instance:
------------------------------------------------------------------------
1 Program NAME;
2
3 Uses Doorkit,Crt,Dos;
4
5 Begin
6 AllWrite('Hello user!');
7 End.
------------------------------------------------------------------------
This would write 'Hello user!' to the user online.
But before you can use this code to make a door you need to add some
lines to make the DOORKIT work properly!
Just before the last 'End'-statement you need to add the line:
------------------------------------------------------------------------
CloseAll;
------------------------------------------------------------------------
Now the DOORKIT knows it has to return the modem to dESiRE and releases
all used memory to the system.
So our DOOR will be:
------------------------------------------------------------------------
1 Program NAME;
2
3 Uses Doorkit,Crt,Dos;
4
5 Begin
6 AllWrite('Hello user!');
7 CloseAll;
8 End.
------------------------------------------------------------------------
This is the most simple door you can write.
╙─────────────────────────────────────────────────────────────────────────·
│ 4. Using the DROPFILE data │
·┘───────────────────────────────────────────────────────────────────────└·
Now we want to use the DROPFILE data such as the name of the user and
his location. All USERDATA of the user online is stored in the DROPFILE
which is in the memory when you use the DOORKIT. You can access this
data by using an object with the name 'DOOR'.
'DOOR' is a RECORD, which means it consist of several types of data. It
consists of
- 'STRING'-types. a STRING constist of a set of characters like
in 'Hello User!' Normally a STRING contains
255 characters but if you need less than that
STRING[x] uses only x characters where x is
a number between 1 and 255.
- 'INTEGER'-types. this is a number. In an 'INTEGER' you can put
numbers between -32768 and 32767.
- 'LONGINT'-types. this is a number. In an 'LONGINT' you can put
numbers between -2147483648 and 2147483647
- 'DOUBLE'-types. this is a number. In an 'DOUBLE' you can put
numbers from 5.0E-324 to 1.7E308. Instead of
the INTEGER and LONGINT type this DOUBLE is
floating point! for example:
A double can be 2 or 2.1 or 2.2 or 2.000001.
A INTEGER or LONGINT can only be 1,2 or 3 etc.
but nothing in between.
- 'BYTE'-types. number between 0..255
- 'BOOLEAN'-types. This can either be 'FALSE' or 'TRUE'.
- 'ARRAY'-types. An array consist of a whole set of types.
For instance:
----------------------------------------------
Array [1..10] of Byte;
----------------------------------------------
Contains 10 bytes after each other.
the 'DOOR'-record in memory consist of the following types:
------------------------------------------------------------------------
TYPE
ConfigRec = RECORD { C:\DESIRE\CONFIG.<Node> }
BBSName : String[30];
Sysop : String[30];
Located : String[50];
Path : String[60];
Data : String[60];
Commands : String[60];
FileToMsg : String[60];
Work : String[60];
Hold : String[60];
LcFiles : String[60];
Node : String[60];
Access : String[60];
Broken : String[60];
LogFiles : String[60];
Scripts : String[60];
Irq : Byte;
ComVector : String[3];
BaseAddr : String[5];
ComType : Byte;
Comport : Byte;
Baudrate : LongInt;
Parity : Char;
CharLength : Byte;
StopBits : Byte;
Inittries : Byte;
InitString : String[60];
OKstring : String[10];
HangUpString : String[60];
BusyString : String[10];
AnswerString : String[60];
RingString : String[10];
OffHookString : String[60];
NotUsed1 : Array[1..315] of Byte;
SystemPwd1 : String[15];
SystemPwd2 : String[15];
NewUserPwd1 : String[15];
NewUserPwd2 : String[15];
VipPreset : Byte;
{ IF Nup2 then what preset to give }
PwdTries : Array[1..8] of Byte;
{ 1 = System Password #1 Attempts }
{ 2 = System Password #2 Attempts }
{ 3 = User Password Attempts }
{ 4 = Newuser Password Attempts }
{ 5 = Conf. Password Attempts }
{ 6 = Command Password Attempts }
{ 7 = Door Password Attempts }
{ 8 = Baudrate Password Attempts }
AskFront : Boolean;
{ Ask system pwd before welcome screen ? }
FlashAtRing : Boolean;
BeepAtRing : Boolean;
FlashAtPage : Boolean;
AskChatReason : Boolean;
AskMailScan : Boolean;
AskDeleteMessage : Boolean;
SystemxDropFile : Boolean;
HowManyNodes : Byte;
MinPwLength : Byte;
ScreenSave : Boolean;
ScrSaveSecs : Integer;
LocalOffHook : Boolean;
WeekTopReset : Byte;
ForeColor : Byte;
BackColor : Byte;
BlinkColor : Byte;
MinSpace : Longint;
MonoMode : Boolean;
AnswerMachine : Boolean;
AnswerComment : Boolean;
RelativeConfs : Boolean;
FullyPrivate : Boolean;
NoSysopCalls : Boolean;
FileUpCase : Boolean;
AskLanguage : Boolean;
AskAnsiGraphics : Boolean;
PageBeep : Boolean;
PageComment : Boolean;
Nu_Hidden : Boolean;
Nu_AutoMsg : Boolean;
Nu_HangUp : Boolean;
Nu_Preset : Byte;
Presets_SecLvl : Array[1..5] of Byte;
Presets_TimeDay : Array[1..5] of Longint;
Presets_ChatDay : Array[1..5] of Longint;
Presets_Bytes : Array[1..5] of Longint;
Presets_ConfACP : Array[1..5] of String[3];
Presets_ConfAcc : Array[1..5] of Boolean;
Presets_Ratio : Array[1..5] of Byte;
Presets_RatioType : Array[1..5] of Byte;
Presets_Flags : Array[1..5,1..99] of Boolean;
Presets_Limits : Array[1..5,1..30] of Byte;
Macros1 : Array[1..10] of String[65];
Macros2 : Array[1..10] of String[65];
NotUsed3 : Array[1..406] of Byte;
ProtoKey : Array[1..10] of String[1];
ProtoName : Array[1..10] of String[30];
ProtoULBat : Array[1..10] of String[8];
ProtoDLBat : Array[1..10] of String[8];
MenuSetName : Array[1..5] of String[30];
MenuSetPath : Array[1..5] of String[60];
MenuSetDoors : Array[1..5] of String[60];
FutureExpand1 : Boolean;
AskGoodbye : Boolean;
FileListClrScr : Boolean;
Mode80x25 : Boolean;
Mode80x30 : Boolean;
Mode80x34 : Boolean;
Mode80x43 : Boolean;
Mode80x50 : Boolean;
Mode80x60 : Boolean;
PwdFillChar1 : Char; { systempasswords }
PwdFillChar2 : Char; { userpassword }
HandleFaxConnects : Boolean;
SkipNewUserApply : Boolean;
DisableMouse : Boolean;
UseCdPlayer : Boolean;
NodeRefresh : Boolean;
LocalWarningIfRing : Boolean;
DontCloseComport : Boolean;
FutureOptions : Array[1..4668] of Byte;
end;
------------------------------------------------------------------------
The texts between '{' and '}' or '(*' and '*)' are comments and do not
mean anything!
If, for instance, you want to write some user information to the user
online you can use 'AllWrite' to show it. But 'AllWrite' only is
able to show 'STRING'-types. In order to be able to show numbers to
you need to convert numbers to a string.
For instance, when Number is a number of 'LONGINT'-type:
------------------------------------------------------------------------
AllWriteln(LongToStr(Number,0));
------------------------------------------------------------------------
This would print the number 'Number' in no particular size.
------------------------------------------------------------------------
AllWriteln(LongToStr(Number,8));
------------------------------------------------------------------------
This would print the number 'Number' using exactly 8 characters whether
the number fits in it or not.
If you want to show data from the DOOR-record you need to use:
DOOR.xxxxxx, where xxxxxx is the name of the datafield.
If you want to show the user's name you do this:
------------------------------------------------------------------------
AllWriteln(Door.Name);
------------------------------------------------------------------------
If you want to show the user's location you do this:
------------------------------------------------------------------------
AllWriteln(Door.Location);
------------------------------------------------------------------------
If you want to show the user's securitylevel you do this:
------------------------------------------------------------------------
AllWriteln(IntToStr(Door.SecLvl,0));
------------------------------------------------------------------------
Notice the use of 'IntToStr' to convert this 'BYTE'-type number to
a string. (the Security level is a number between 0 and 255)
╙─────────────────────────────────────────────────────────────────────────·
│ 5. How to contact xROADs │
·┘───────────────────────────────────────────────────────────────────────└·
Eternal Damnation
+31-765-600721
Or E-mail us at
xroads@stack.nl
Or visit the webpage at
www.stack.nl/~xroads
Or join #XROADS or #DESIRE on Efnet
╙─────────────────────────────────────────────────────────────────────────·