home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
modem
/
jbtutor1.zip
/
LESSON9.TXT
< prev
next >
Wrap
Text File
|
1993-09-19
|
4KB
|
81 lines
Back in Lesson #6 I briefly mentioned dedicating a separate section
of your scripts for variable definition. Before I continue with the
mailrun script we're developing, I'd like to expand on the importance
of variables (I'll be using variables in upcoming segments).
In my opinion, user defined variables was the single most significant
change Fred made to {COMMO} macro processing since the early days.
I'll mention three specific advantages to variables at the end of
this lesson.
When writing a script, I recommend that you never "hard code" any
data into your routines. For example, I would suggest that you not
code in any drive\path info in your macro commands, e.g.,
{EXEC dsz rz c:\mail}
{EXEC dsz sz c:\mail\bbsname.rep}
Some variables I've found useful are:
repdir -- the drive\directory where my mail .REP files are kept
qwkdir -- the drive\directory where I want my new .QWKs to go
bbsid -- the name the BBS uses for its mail packets
mainm -- the Main Menu prompt for the BBS
mesgm -- the Message Menu prompt for the BBS (assuming you
can't get to the mail door from the Main Menu)
doorm -- the Door Menu prompt for the BBS (same assumption as
"mesgm"
zprog -- the drive\dir\filename of the ZModem program I use
suffx -- set to one of two values -- "null" or "|", used to
discriminate between BBSs that have hot-keys and
those that don't
Note: you aren't required to use the same names I've chosen, nor do
you even have to use any of the above variables at all. Pick names
and variable functions that you are comfortable with and that fill
your needs.
If a variable is BBS-specific (for example, "bbsid") then I recommend
setting these variables in the .FON. This way, the variable will be
automatically set to the correct value upon logon with the board to
which the variable value will apply.
If a variable is global to the script (will apply to all BBSs) then
you can set these in the dedicated variable definition area of your
.MAC. Some examples of "global" variables might be: repdir, qwkdir,
zprog.
To recap, the advantages of using variables instead of "hard coding"
values in your scripts are:
a. If a BBS sysop makes any changes to his board that would
affect your script, it's quick and easy to make the
corresponding adjustments to your script..all you need to do
is edit the appropriate variable..you don't have hunt all
over your script for the macro commands needing revision.
b. If you ever want to change your own setup (for example, the
directory where your mail goes or the ZModem program you
use), then again it's very easy to make the change to your
script. You don't have to make numerous changes to
different hard-coded values..thus, you don't risk missing an
edit and having your script hang on you next time.
c. Variables make it easier to adapt a single script to
multiple BBSs/BBSware types. For example, it's common for
BBSs to have different Main Menu prompts, even amongst
boards using the same BBSware. Without variables, you'd
need to account for every prompt variation in a separate
"LOOK" command. If you use a variable for the prompt, you
can do it all with something like:
{LOOK %mainm}
Next up..we continue with the mailrun macro. In the meantime, refer
to your {COMMO} docs on how to set variables in your .FON. Also,
review the SETVariable command.
Jim
... Tag-Man * COMMO #88