root/trunk/docs/dosdoors.txt

Revision 35, 14.4 kB (checked in by frank, 17 months ago)

Updated crashmail.prefs.sample to fix a typo
Created docs/ftn/ftp with a sample set of ftp scripts for transfering ftn echomail
Created docs/ftn/echomail.sh - a sample bash cron script for tossing and scanning echomail

  • Property svn:keywords set to ID LastChangedDate LastChangedRevision LastChangedBy HeadURL
Line 
1This is a howto for getting dos doors up and running under Enthral BBS.
2
3# Enthral SVN: $Id$
4# Source: $HeadURL$
5# $LastChangedDate$
6# $LastChangedRevision$
7# $LastChangedBy$
8
91st edition, expect revisions.
10Created by esc.
11
12CONTENTS:
131 - Introduction / Notes
142 - Theory of Operation
153 - Autoexec.bat
164 - door_script
175 - Example start.bat
186 - Modifying DOSEMU control files
197 - Enthral Menu Commands
208 - Contact info
219 - CHANGELOG
22
23
24CHAPTER 1 - Introduction / Notes
25A few notes:
26
27I am using Enthral alpha, build .401.  Some things may change in the
28future.  Additionally, I'm using dosemu 1.4, the latest release as of
29April 1st, 2009.  Finally, I'm using gentoo x86, kernel 2.6.27.
30
31A few things to note:
32
33I launch the bbs from the directory /home/bbs/enthral/.  My user 'bbs',
34the owner of the bbs files, has a $home directory located at /home/bbs/. 
35When I am local, as the user 'bbs', and I launch dosemu, it links to
36/home/bbs/.dosemu/.  That being said, as the user bbs, launching dosemu
37in a terminal window, my "C:\" drive is located at
38/home/bbs/.dosemu/drive_c/.
39
40However, when launched from my door script, it links to
41/home/bbs/enthral/.dosemu/, with the "C:\" drive being
42/home/bbs/enthral/.dosemu/drive_c/.  The reason I do this, is so that
43when a user is logged on and playing dos doors, you can locally log on
44as user 'bbs' or whomever you use, and you can launch dosemu locally to
45modify some settings or install more doors, without accidentally
46launching the door they're already in :)
47
48
49CHAPTER 2 - Theory of Operation
50
51
52Now, the theory of operation.  Ideally, this is what needs to happen:
53
541 - Command key is pressed.
55        D- is the internal enthral command to create dropfiles and run a
56        door.
57
58        Drop files are placed in BBSDIR/node/node(current node number)/
59        Essentially, node 1 on my bbs will make:
60                /home/bbs/enthral/node/node1/DOOR.SYS
61                /home/bbs/enthral/node/node1/DORINFO1.DEF
62                /home/bbs/enthral/node/node1/CHAIN.TXT
63
64        Keep in mind, enthral will make DORINFO#.DEF for all nodes, with
65        DORINFO1.DEF for node 1, DORINFO2.DEF for node 2, etc.
66
67        Enthral will then launch an external script.  It will be a bash
68        script, and is the basis for running all dos doors.  It will
69        essentially create the necessary batch files so that upon
70        launch, dosemu will automatically run the door with the proper
71        arguments.
72
73        Dosemu's autoexec.bat will automatically run the batch file
74        created by the previously mentioned bash script.  That batch
75        file will change to the desired door directory, and launch
76        the door with the proper node/directory arguments included.
77
78        Finally, the batch file will exit back to the bbs.
79
80Theory of operation complete.  Ok, got it?  Good, on to the example
81files :)
82
83CHAPTER 3 - Autoexec.bat
84
85We'll start with autoexec.bat.  I've modified both my
86/home/bbs/.dosemu/drive_c/autoexec.bat, as well as the
87/home/bbs/enthral/.dosemu/drive_c/autoexec.bat.  The changes that we
88need to make are as follows:
89
90We need to make the file and directory structure make more sense for
91configuring doors, as well as call up a fossil driver, and finally call
92the batch file to run the doors.  What I suggest is changing to your
93/home/bbs/enthral/.dosemu/drive_c/ directory, and downloading BNU, as
94well as unzipping it.  Put it in your drive_c/ dir, but mkdir bnu and
95put the necessary files in there.  It's up to you, but that's just how I
96do it.  Here's MY autoexec.bat, with a line by line explanation.
97
98BEGIN AUTOEXEC.BAT:
99---------------------------------------------------------
100
101
102
103@echo off
104path z:\bin;z:\gnu;z:\dosemu
105set HELPPATH=z:\help
106set TEMP=c:\tmp
107prompt $P$G
108lredir d: linux\fs/home/bbs
109lredir f: linux\fs/home/bbs/enthral/doors
110
111c:
112cd\bnu
113call bnu.com /L0:57600,8N1 /F
114
115c:
116cd\
117rundoor.bat
118
119
120The @echo off is to keep the batch file from displaying all lines of
121instructions to the console.
122The path is to simplify typing things in later, not really necessary.
123The help path and temp directories were set that way by dosemu
124initially, and I'm not sure what they're for...I just left them :)
125The prompt $p$g gives us our nice "C:\" prompt.
126lredir d: linux\fs/home/bbs
127
128^^^^ This is important.  This links your /home/bbs/ directory to D:\.
129Change this to say:
130lredir d: linux\fs/YOUR BBS USER'S HOME DIRECTORY
131
132lredir f: linux\fs/home/bbs/enthral/doors
133
134^^^^ This is equally important.  This links your doors directory to F:\.
135Change this to say:
136lredir f: linux\fs/YOUR DOORS DIRECTORY
137
138c:
139cd\bnu
140call bnu.com /L0:57600,8N1 /F
141
142^^^^ Change to your bnu directory that was discussed earlier.  Call
143bnu.com will load the tsr into memory.  It's important for some doors
144that you lock the port, and the arguments above lock it as virtual com1,
14557600 bps, fast ansi.  It works right 100% of the time this way, so
146don't change it :)
147
148c:
149cd\
150rundoor.bat
151
152^^^^  This is the part that will actually run the door.  rundoor.bat
153will be created by the bash script that we're going to create next. 
154I'll explain when we get there.
155
156-----------------------------------------------
157END AUTOEXEC.BAT
158
159
160**NOTE:  The rundoor.bat is not necessary in the autoexec.bat that is
161contained in your $HOME/.dosemu/drive_c/ directory, only the
162BBSDIR/.dosemu/drive_c/ directory.  However, if the rest is the same, it
163works very well for launching things like lordcfg.exe or whatever you
164need while someone is playing doors.
165
166
167CHAPTER 4 - door_script
168
169
170Now, we'll move on to the file you're actually going to call FROM
171enthral, via the D- command.  I'll explain the menu commands later, but
172for now, we need to make a file.  I like to call it door_script.  I
173place this file in /home/bbs/enthral/doors/dos/, but you can place it
174anywhere, however it's best to do it from somewhere connected to your
175enthral bbs directory.  Here is door_script:
176
177
178
179#!/bin/bash
180export HOME=/home/bbs/enthral
181printf "Loading $2 ..
182
183"
184unix2dos /home/bbs/enthral/node/node$1/DOOR.SYS
185unix2dos /home/bbs/enthral/node/node$1/DORINFO?.DEF
186unix2dos /home/bbs/enthral/node/node$1/CHAIN.TXT
187
188rm /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
189echo -e "\r@echo off \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
190echo -e "f: \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
191echo -e "cd $2 \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
192echo -e "call start.bat $1 \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
193unix2dos /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
194
195/usr/bin/dosemu -u virtual -I 'keystroke "\r"' #2>/dev/null /dev/null
196
197rm /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
198
199
200Now, a line-by-line explanation.  Some of these commands may be
201superfluous or unnecessary, but I'll explain them anyway.  Hell, it
202works :)
203
204#!/bin/bash
205This line tells linux that you're executing a bash script.
206
207export HOME=/home/bbs/enthral
208This line is what I did to make dosemu look into the BBS
209directory/.dosemu/ for all of its information.  I find that this works
210very well, and suggest you don't change it, aside from reflecting your
211own bbs dir.  All it really does is make a different autoexec.bat
212launch, but it adds some functionality.
213
214printf "Loading $2 ..
215
216"
217This will write "Loading LORD" or "Loading USURPER" or whatever.  Not
218really necessary, but it works.  The $2 means it's the second argument
219passed in the launching of the script.  I'll get more into that later.
220
221unix2dos /home/bbs/enthral/node/node$1/DOOR.SYS
222unix2dos /home/bbs/enthral/node/node$1/DORINFO?.DEF
223unix2dos /home/bbs/enthral/node/node$1/CHAIN.TXT
224This changes all of the dropfiles from linux format to contain dos style
225CR/LF's at the end of every line.  This causes the dropfiles to be
226readable by the dos doors.  Now, the latest version of unix2dos will
227automagically modify the files and output them to their original
228filenames.  If you have an old version of unix2dos (I suggest you
229upgrade), you may have to unix2dos directory/DOOR.SYS
230directory/DOOR.SY1, and copy it back later.  Do the same for all
231dropfiles...but if you upgrade your unix2dos, this won't be necessary :)
232
233rm /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
234This will delete the old rundoor.bat located in C:\.  It's important to
235do this before making a new one, or it will just append.
236
237echo -e "\r@echo off \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
238echo -e "f: \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
239echo -e "cd $2 \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
240echo -e "call start.bat $1 \r" >> /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
241unix2dos /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
242Ok, this is the interesting part.  Remember that we made autoexec.bat
243look for a file, c:\rundoor.bat, right?  Well, in this portion, we
244create it.  The $1 is the node number, being passed from enthral.  The
245$2 is the door name, which also has to be the directory under f:\ that
246the door is located...so install lord to f:\lord, lord2 should be
247f:\lord2, etc.  Keep them all 8 characters or less...Planets: TEOS will
248be f:\teos, for example, you get the idea.  Here's what would happen if
249we tried to launch this from enthral on node 1 with the door name being
250"LORD".  We'd make the following c:\rundoor.bat:
251
252@echo off
253f:
254cd lord
255call start.bat 1
256
257
258Also, remember to put the unix2dos command in there, so that the file is
259readable by dos.
260
261/usr/bin/dosemu -u virtual -I 'keystroke "\r"' #2>/dev/null /dev/null
262This is where we actually call dosemu.  /usr/bin/dosemu is where it's
263found on my installation, but change appropriately.  The -u virtual is
264important to make a virtual comport to pipe everything through.
265
266rm /home/bbs/enthral/.dosemu/drive_c/rundoor.bat
267Just doing some cleaning up after a proper exit of the door :)  I know
268it's redundant to have it in the door_script twice, but redundancy is
269sometimes helpful to alleviate potential problems.
270
271Finally, make that file executeable.  After creating door_script,
272remember to chmod +x door_script.
273
274
275CHAPTER 5 - Example start.bat
276
277
278Ok!  That was the hardest part, I suppose.  Keep in mind that
279rundoor.bat will go to the door directory, and launch start.bat with the
280node number as an argument.  I'll leave it up to you to create a
281start.bat for each of your doors, but I'll explain the basics here:
282
283random start.bat:
284
285@echo off
286f:
287cd \doorgamedirectory
288pause
289call doorgame.exe %1
290exitemu
291
292Explanation:
293@echo off
294Don't pipe batch output :)
295
296f:
297door drive
298
299cd \doorgamedirectory
300change to the directory once again...redundant I know :)  But it works!
301
302pause
303This is necessary because of the -I 'keystroke "\r"' upon launch of
304dosemu...it's more of a hack than anything else, because if we don't put
305the keystroke arg in there in the first place, it won't launch for some
306reason.  So just put the pause in there and it'll work for you :)
307
308call doorgame.exe %1
309This is to actually launch the door.  The %1 is the node argument being
310passed from c:\rundoor.bat to this file.  Remember some games need other
311arguments, like you may need to point to the dropfile, in which case it
312would be something like
313call doorgame.exe %1 d:\enthral\node\node%1\DOOR.SYS, or
314you may need
315call doorgame.exe %1 /DREW (lord for example).
316
317exitemu
318This exits dosemu after the door closes properly.
319
320Some things to note:  D:\ is your /home/bbs directory.
321That being said, when you setup your doors, have them look for dropfiles
322in D:\enthral\node\node#, with the # changing for each node.  If I could
323explain each door I would, but I'd be here all day :)
324
325
326CHAPTER 6 - Modifying DOSEMU control files
327
328
329Now that that's all taken care of, there are just a couple of small
330things to worry about.  Dosemu is NOT setup out of the box to do things
331like this, so we need to make a few small modifications to how dosemu
332works.  Here's what I've done:
333
334In /etc/dosemu/dosemu.conf, add the following toward the top of the
335file:
336
337ifdef u_virtual
338        serial { virtual com 1 }
339endif
340
341
342This will enable the virtual comport on com 1 for us, and pipe
343everything appropriately.
344
345Additionally, go through the file and uncomment the following lines,
346making them the same values that I have:
347
348$_cpu = "80586"
349$_hogthreshold = (10)
350$_dpmi_base = (0x10000000)
351$_external_char_set = "cp437"
352$_internal_char_set = "cp437"
353$_layout = "us"
354
355
356EVERYTHING ELSE NEEDS TO BE COMMENTED, or you only have yourself to
357blame for funny input/output issues :)  This is the first place I'd look
358if things aren't displaying properly.
359
360In your /etc/dosemu/dosemu.users, append the following line at the end:
361
362bbs c_all
363
364This will make the bbs user able to do whatever he needs to in dosemu. 
365Not sure how necessary it is, but it'll alleviate any problems in the
366future with accessing directories or whatever.
367
368Leave your /etc/dosemu/global.conf alone, it's not a big deal.
369
370Finally, I chose to edit my /usr/bin/dosemu executable file.  I CAUTION
371YOU to not do this, but if you're feeling adventurous, go for it. 
372Dosemu wants a 25 line terminal, and will complain upon startup. 
373If you look for where it does that stupid complaining crap and change
374the value from 25 to 24, you'll prevent it from complaining in the
375future.  I won't explain exactly how to do this because I caution
376against it and don't want to be held accountable for broken dosemu's :) 
377So, Good luck!
378
379
380CHAPTER 7 - Enthral Menu Commands
381
382
383Finally, your setup in your BBSDIR/menu/main.txt or doors.txt if you
384create one...
385
386We'll use lord as an example here, and we'll use CommandRec 001, but
387ensure you change that to the sequential number that this command will
388actually be in your menu data.
389
390[CommandRec001]
391LDesc[001]      = "lord"
392SDesc[001]      = ""
393CKeys[001]      = "L"         < Use whatever you want to launch the
394door.  I use L, but you can use a number or something else if you want.
395Acs[001]        = "s50"       < Registered users only.  Not a big deal.
396CmdKeys[001]    = "D-"        < Create dropfiles, launch a door.
397MString[001]    = "/bin/bash /home/bbs/enthral/doors/dos/door_script %NN LORD"
398This will launch the bash script we made earlier.  Just have it point to
399your door_script file.  Pass %NN as the first arg, which is the node,
400and the name of the directory where your door game is located under the
401F:\ dir as your second arg.
402HiString[001]   = ""
403LoString[001]   = ""
404Xcoord[001]     = ""
405Ycoord[001]     = ""
406LBarCmd[001]    = "FALSE"      < Change all of this for litebars.
407SText[001]      = "FALSE"
408STLen[001]      = "0"
409
410That should do it!
411
412
413CHAPTER 8 - Contact info
414
415
416The end of this file will be a changelog that I will update with each
417revision of this file.  If you have any questions, find myself,
418Mercyful, or Netsurge on irc...irc.bbs-scene.org #bbs.  Or on haunting
419the chapel bbs, htc.zapto.org, or the enthral support website,
420http://www.enthralbbs.com.  Thanks!
421
422
423
424CHAPTER 9 - CHANGELOG
425
4262 APRIL 2009
427Initial version of dosdoors howto.
Note: See TracBrowser for help on using the browser.