Originally posted by Pete Green
Im not even a cop. get real.
are you the CEO I dropped off at Github a few years ago? I should learn coding. Python at least. im sorry I didn't learn sooner. I mean BASIC and perl we didn't have a monitor back then. everything was written on a dot-matrix. i should of kept at it. CS 101. we made neato banners though. Dot-Matrix printers are bad ass.
never too late to learn . I never took it seriously my entire life and I am starting to regret it now but with these tools and resources I think anyone can learn any language if they want to
funny you mention pascal
How to learn to write a door using Borland Pascal 7.0tm & the doorkit!
+--------------------------------------------------------------------------+
| 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 issue of doorsx.txt is the first and i hope I will do a few more
in the future, this doc was ment to show Zester how to code doors because
Wizard is short of door coders!!(apply!!) Iïwe included some sources and
an uart doorkit. Parts of this document ar ripped from Xroads doorinfo.doc
I hope yoïre not angry.
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 SYSTEM/X
boardsystem. When it is executed it takes over SYSTEM/X 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 SYSTEM/X
and the modem to the system and quits. SYSTEM/X 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 SYSTEM/X 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 SYSTEM/X he needs
to write it back to disk.
When returning to SYSTEM/X 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 SYSTEM/X 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 Doorkitu,Crt,Dos;
------------------------------------------------------------------------
The DOORKIT consists of several commands to be used with SYSTEM/X. For
instance, if you want to write a sentence to the user online you need
the 'CWrite'-command. For instance:
------------------------------------------------------------------------
1 Program NAME;
2
3 Uses Doorkitu,Crt,Dos;
4
5 Begin
6 CWrite('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 SYSTEM/X and releases
all used memory to the system.
So our DOOR will be:
------------------------------------------------------------------------
1 Program NAME;
2
3 Uses Doorkitu,Crt,Dos;
4
5 Begin
6 CWrite('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
DoorRecord = RECORD (* C:\BBS\DATA\SXDOOR.xxx *)
Name : String[30];
Location : String[30];
RealName : String[30];
NetMailName : String[30];
Password : String[15];
Phone : String[30];
Computer : String[30];
ACP : String[3];
LastConf : Longint;
Lines : Byte;
ConfAccount : Boolean;
Ratio : Byte;
RatioType : Byte;
SecLvl : Byte;
CallsTotal : Longint;
CallsWeek : Longint;
CallsMonth : Longint;
Ups : Longint;
Downs : Longint;
Upk : Double;
DownK : Double;
DownToday : Longint;
BytesAvail : Longint;
MsgPosted : Longint;
MsgReceived : Longint;
Cps_Up : Longint;
Cps_Down : Longint;
WeekUpk : Longint;
WeekUps : Longint;
WeekDownk : Longint;
WeekDowns : Longint;
MonthUpk : Longint;
MonthUps : Longint;
MonthDownk : Longint;
MonthDowns : Longint;
FakeUps : Longint;
FakeUpk : Longint;
FreeDowns : Longint;
FreeDownk : Longint;
LastDate : String[8];
LastTime : String[8];
FirstDate : String[8];
FirstTime : String[8];
BirthDate : String[8];
(* ALL TIME LIMITS ARE IN SECONDS *)
TimeLeft : Longint;
TimeDay : Longint;
TotalTime : Longint;
NodeChatAvail : Longint;
NodeChatLeft : Longint;
NodeChatTotal : Longint;
SysopChatTotal : Longint;
SysopChatRecord : Longint;
MenuSet : Byte;
Protocol : Byte;
Deleted : Boolean;
Hidden : Boolean;
CmndMode : Boolean; { False = Seclvl, True = Very Own}
SentBy : String[80];
Flags : Array[1..150] of Boolean;
PageTries : Byte;
FutureExpand1 : Array[1..29] of Byte;
LcDate : String[8]; { VARIABLES from LASTCALL }
LcLogontime : String[8];
LcBaudRate : String[6];
LcBaudStr : String[40];
LcDownload : Boolean;
LcUpload : Boolean;
LcPosted : Boolean;
LcRead : Boolean;
LcWantedChat : Boolean;
LcChated : Boolean;
LcNodeChat : Boolean;
LcScanned : Boolean;
LcLostCarrier : Boolean;
LcHacking : Boolean;
LcDowns : Integer;
LcUps : Integer;
LcDownk : LongInt;
LcUpk : LongInt;
SysopAccess : Boolean;
ChatOnOff : Boolean;
StatLineOn : Boolean;
CaptureOn : Boolean;
TempFreeLeech : Boolean;
Reserved : Boolean; {NOT USED YET}
Paged : Boolean;
Ansi : String[3]; (* 'ANS' or 'ASC' *)
Local : Boolean;
ConfPath : String[60];
ConfName : String[30];
OpenParams : String[255];
OnlineBaud : Longint;
Node : Byte;
HiddenNode : Boolean; { 1.1 }
FutureExpand2 : Array[1..333] 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 'CWrite' to show it. But 'CWrite' 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:
------------------------------------------------------------------------
CWriteln(int2Str(Number,0));
------------------------------------------------------------------------
This would print the number 'Number' in no particular size.
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:
------------------------------------------------------------------------
CWriteln(Door.Name);
------------------------------------------------------------------------
If you want to show the user's location you do this:
------------------------------------------------------------------------
CWriteln(Door.Location);
------------------------------------------------------------------------
If you want to show the user's securitylevel you do this:
------------------------------------------------------------------------
CWriteln(Int2Str(Door.SecLvl,0));
------------------------------------------------------------------------
Notice the use of 'Int2Str' to convert this 'BYTE'-type number to
a string. (the Security level is a number between 0 and 255)
I have included some sources, each of the have a doc and some comments.
Start with frstdoor.doc its the easiest and work throug them.
If you hamve any problems or want more dox like this contact us!
Good luck whit your door coding!
/Ballista/Wizard
+--------------------------------------------------------------------------+
| 5. How to contact Wizard |
+--------------------------------------------------------------------------+
ARiONA WiZARD Whq +46-(0)381-91080
Or E-mail us at
ballista@algonet.se
Or join os at irc
#Wizard
+--------------------------------------------------------------------------+