                           Question for DLG BBSs
                         (pd) 1992  by Doug McLean
                         -------------------------

What It Is
~~~~~~~~~~
Question is a little hack to generate the User_Name.Notes that DLG stores
in the dlgconfig:notes/ directory. These notes are shown to the Sysop
at the beginning of a chat session, and may be accessed from the user
editor. I wrote this program because I needed to keep notes on users,
but I didn't want to enter all that info myself.

You could use Question to send the output to some other file, or to send
the output for all users to a single file, the choice is yours.

Question can be set to ask the user the questionaire every time it is run,
or to exit if the user already took the questionaire. And you can set
multiple questionaires with seperate menu entries.


About These Docs
~~~~~~~~~~~~~~~~
I hate writing docs, it is late at night, and I wrote these docs in a hurry.
If anything is left out, or wrong, I'm sorry. I'll be happy to answer any
questions you have via routed netmail.


Legal Stuff
~~~~~~~~~~~
I do NOT assume any responsibility for what Question does or does not
do on your system. I have tested it on my system, and it works fine. If
it trashes your hard drive, gurus your system, or does any other nasty
things, I'm sorry, but it is your problem, not mine. It should be ok,
it works fine here, but if you have problems, I assume no responsibility.

Question is PD. If you like it, great! If you don't, that's fine too. It
does exactly what I want it to do, so I'm happy.

I do not plan to support or update Question. But it would be very easy
to update or expand, so if you have any ideas, send them along and if
I like your ideas I'll do an update! The way it is written, Question
would be very easy to upgrade.


What's Included
~~~~~~~~~~~~~~~
question            - The executable program
question.docs       - What you are reading now
qfile               - Sample input (question) file
Doug_Mclean.notes   - Sample output file


Setting It Up
~~~~~~~~~~~~~
Create a directory somewhere, and copy the executable (Question) and the
sample input file (Qfile) to it. Edit the sample question file to suit
your needs. See below for info on the question file.

Next add Question to your login.dlgbatch file (in dlgconfig:batch). A good
place is at the end of the batch file. Or you could create a menu entry for
it (I have NOT tested it from the menu, but it should work. Answer NO
to CLI mode, and NO to CHAIN).

The command line syntax is:

QUESTION Infile Outfile %UNAME %ANSI <o<TextFile>>

My dlgconfig:batch/login.dlgbatch calls Question as follows (but all
one line):

doors:question/question doors:question/qfile dlgconfig:notes/%UNAME.notes
%UNAME %ANSI o

The optional o means skip the questionaire if the output file exists.
If o includes a filename (oTextFileName), the file will be shown to the user.
Otherwise, the user will never know Question was run.

If the o option is not present, then the results are appended to the output
file if it exists, or the file is created if it doesn't exist.


Input File Format
~~~~~~~~~~~~~~~~~
The input file is almost like a very simple script. Each line contains
a command in the first column, a modifier in the second column, and
sometimes a string of text starting in the third column.

XZString
^^^
||+- Col 3 - String to be sent to user for some commands
|+-- Col 2 - Result option (Y or N or *)
+--- Col 1 - Command character

X is a single command character. They are listed below.
Z is either a Y, an N, or a *.
  If this character is a Y, then this line will be executed ONLY if
    the user answered Yes to the last question asked (with the Q command).
  If this character is a N, then this line will be executed ONLY if
    the user answered No to the last question asked (with the Q command).
  If this character is a *, the line will be executed regardless of
    the last response.
String is a string that some commands require. It is ignored for other
  commands. See the commands listed below.

**** You MUST supply either a Y, N, or * as the second character on each
**** line. This implies the the minimum number of characters on a line is 2.


Command Characters
~~~~~~~~~~~~~~~~~~
P  Print string to user, do not follow with return.
   String required, must start in 3rd col.
p  Same as P except a RETURN is added at the end of the line.

L  Print string to output file, do not follow with return.
   String required, must start in 3rd col.
l  Same as L except a RETURN is added at the end of the line.

U  Print users name to log file, do not follow with return.
   No string required.
u  Same as U except a RETURN is added at the end of the line.

B  Prints blank line to user.
   No string required.
b  Same as B.

Q  Requires Y or N response from user.
   String (if present) is printed to user, not followed by a return.
q  Same as Q except a RETURN is added at the end of the line.

A  Write Yes or No to log, depending on last Q response.
   A return is not added to the end of the line.
a  Same as A except a RETURN is added at the end of the line.

T  Print text file to user. File pauses every 20 lines.
   File name required, must start in 3rd col.
t  Same as T.

C  Clear screen.
   No string required.
c  Same as C.

N  Ask the user for a number. Result is written to log followed by return.
   The string (if present) is sent to the user, not followed by return.
n  Same as N except a RETURN is added at the end of the line.

I  Ask user for lines of input. Input continues until user hits return
   at the start of a line. Results are written to log file.
   String is sent to user (if present) followed by a return.
i  Same as I.

S  Same as I, except only one line of input is accepted.
s  Same as S.

X  Exit the questionaire. Useful for terminating the questionaire
   early based on the last Q response.
x  Same as X.

As you can see, in many cases an UPPER case letter will leave the
cursor on the same line, while a lower case letter moves the
cursor to the next line for input.

That's All!
~~~~~~~~~~~
This may all look a bit confusing, please see the enclosed example file.
You may want to examine the sample question file and sample output
file together to get a better understanding of how it works.

That's about it!  If you have any questions, comments, suggestions, 
bug reports, or anything else to say, let me know on my BBS at FIDO
1:255/9, or (506) 636-9117.

Doug McLean

