home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
MISC
/
TGARTS.ZIP
/
TGPROG.DOC
< prev
next >
Wrap
Text File
|
1999-12-13
|
9KB
|
170 lines
Telegard Programming
by Scott Adams
So you wish to make third party support programs for Telegard.
Then this article might give some slight insight. It is assumed
that you do have SOME minor programming experience under your belt.
You should have a basic grasp of programming in Pascal or C to
use this article. IF you do not there are plenty of tutorials
out there you can find that will help. IF you have no experience
in programming then this article will be utter confusion for you
unless you are just a fast learner. Programming is more complex
than doing a simple Telegard script (which is easier). Telegard
structures are in both Pascal and C format. Since I'm secure with
pascal more than I am C I will save my sanity by using pascal
as the language of choice for this article.
* What will you need?
1) A pascal or C compiler that can compile the code into .exes.
2) The Telegard software for test purposes and
3) The Telegard Development Kit which is currently Tgdev309.zip
which is a major change over the 301 kit. Due to many changes in
data structures you should use this kit for the most modern support.
4) If you are to use C then you will need the Telegard.H file.
Otherwise pascal people will use the Telegard.inc file. These 2
files are the actual Telegard structures and record formats. You
will need to use a include statement to include the file. You could
also just copy the file itself into your code as a core record.
5) You will need to have the docueentation at hand. The file
Devel309.doc explains ALOT of details that you should read about
before you begin coding.
The Development kit comes included with a test program both in C
(testh.c) and in pascal (testinc.pas. All this test program does
is to output to a file (test.out) the record sizes of the structures.
This shows simply how to access the core data and shows the record
sizes as well for programming.
. Note: Bitplane.pas is a complex file and is not for newbies who
are just jumping into their first program. Since this article will
only touch on some of the basics I will skip this file for now.
Maybe in a update article I could write about it.
Incidently with this article I will include the Development kit
with the newsletter archive (tgdev309.zip) so you will be able to
jump in and start programming. This will save time rather than going
to find it on the web site.
Most people only learn from example on programming so how about
we just jump in and do some sample mini programs and maybe a large one?
As always BACKUP your DATA FILES. I take NO responsiblity on
problems that will occur on your system. I only know the code works
fine on my computer. What it does on yours is out of my hands.
My code is using the Borland Pascal v7 compiler.
All sample programs and code will be in Sample.zip with this
archive.
Note: I normally would use my personal toolboxes to code programs
that I have developed over a decade of programming. But it would
only confuse those who might not know the complexity of toolboxes.
Therefore I will only use basic low level code that might be even
inefficient :).
1) Config.tg / Tgconfig.*
Config.tg is the CORE control file of Telegard. If this data
is corrupt then Telegard will NOT work. I will show a short example
of how to read the data, display it, change some data and then write
that new data back. This sample is tgconfig.pas and tgconfig.exe.
What this small program will do is load the ONE (theres only 1 record
to load in config.tg) record from config.tg, give a menu to the
user to either display some bbs info or the Telegard paths. I then
prompt the user in each screen if they wish to change the BBS Name or
the Menus path. You can either hit enter to keep the old data or
enter new data. This file should be run in your main Telegard directroy.
You might want to make a config.bak backup file of config.tg just in
case you mess something up. Change the BBS name it won't hurt naything
either way but changing the menu path could interfere with finding
your menus. Lastly the option to save that record back to the file is
allowed or you can simply quit the program.
2) Users.dat - Tguser.*
Telegard uses Sets wisely to store efficient use of data storage.
Sets might be hard to figure out for some programmers so I will give an
example of reaidng such data using the User database. I wrote TGuser
which shows a user summary and show user status flags for users. The
flags are actually a SET structure. This code (tguser.pas) shows how
to access that set data, show if it applies and even edit that data.
This might be useful for those who do not know how to manage Sets.
If you are to program in Telegard it might be wise to use the
various Indexes. These indexes allow quicker and efficient access to
the data without having to trace through a large database. For
example say you know the user number you wish to access and obtain
the user's name. You could wade through each record and read it
OR you could access users.idx which contains only the user names
and their respective numbers. You could then 'seek' (see tguser.pas
for example) to that record and get his name. These indexes are
maintained by the Index.exe utility (thus why you should run Index
build all nightly).
This program requires users.dat in your \data directory so place
this program there to see how it works. As always make a backup.
3) Laston.dat / Tglast.*
This demo shows how to access the Laston.dat file which is in
your \data directory (run the program from there). This will output
a simple Telegard color coded (using the `xx color codes) a bulletin
for you to display or just look at. The important part of this
demo is it used dtime.pas which is a good unit to have if you need
to figure out the unixtime and date routines that Telegard uses.
I show how to obtain that unixdate (for example) and display it. Just
in case you do not have the tgtype.exe file to display this file
in true color format I will include it with the sample archive.
4) Shortmsg.dat / tgshort.*
When a user logs on to the BBS he will receive personal notes
before the email comes up. These notes are short msgs that include
notes of file credits given, when a person replied or received
yoru email and what not. I wrote this demo to show another way
to access the TG data files. This will simply purge or remove the
old entries the person has read. Then it will append to th efile
a note to the sysop that some entries were purged! This program
will need to find the shortmsg.dat file which is in your \data
so run it from there. Once its done you can then login as sysop
and verify the note is there for you.
5) Voting.dat / tgvote.*
Voting.dat is the TG data file that contains all your voting
records. This simple demo program will create bulletins from this
data. It will create vote?.msg where ? is a letter from A to T
that corresponds with the voting record. It will only output those
voting records which are active. This demo is not fancy but you
could adapt it to look like the old TG 2.7 voting ansi bulletin
maker which had a bar graph color output. Something to consider.
This demo shows how easy it is to make a bulletin program for your
bbs. Again this file should be run in your \data directory where
voting is. It will output the files there so you should move them
to your \text directory if you use them or use tgtype to view them.
These are simple demos and are not to be maant as tutorials
on programming. I will appreciate any questions or feedback you
wish to send in. I was going to do a complex menus editor but
due to time (writing this during the x-mas holiday season of '98)
I ran out of time. Maybe in a future issue I will do the editor
if I get enough feedback or demand for it.
------------------------------------------------------------------
To contact me for feedback on the article or questions/comments:
BBS: 904-733-1721 Fringe BBS-EWOG II (guest account avaliable)
Email: longshot@darktech.org ICQ #: 24436933
website: http://users.cybermax.net/~longshot
Netmail: FidoNet 1:112/91 Fido TG Echo: Tg_support
I welcome any comments or questions ohe articles. If enough
feedback is given I can do article follow-ups. I suggest you also
send feedback to the the other article authors of this newsletter
for without feedback the desire to continue is difficult.
------------------------------------------------------------------