END-CHOOSE directive for .nethackrc

Add an optional way to terminate the last section after a CHOOSE
directive in the run-time options file so that it's possible to
revert to common options.  If no END-CHOOSE directive is present
then the last CHOOSE section continues until the end of the file.
(All existing uses of CHOOSE already behave that way.)

Change the Guidebook to refer to OPTIONS=x, AUTOPICKUP_EXCEPTION=y,
CHOOSE=z, and so on as "directives" rather than "statements".  It
just feels like a better fit.
This commit is contained in:
PatR
2020-08-06 15:57:05 -07:00
parent 318a56669d
commit 2392832f22
4 changed files with 122 additions and 41 deletions

View File

@@ -45,7 +45,7 @@
%.au
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.7 by Mike Stephenson and others)}
\date{July 25, 2020}
\date{August 5, 2020}
\maketitle
@@ -3359,18 +3359,18 @@ Any line in the configuration file starting with `{\tt \#}' is treated as a comm
Empty lines are ignored. Any line beginning with `{\tt [}' and ending in `{\tt ]}' is considered a section
marker. The text between the square brackets is the section name.
Lines after a section marker belong to that section, and are
ignored unless a CHOOSE -statement was used to select that section.
ignored unless a CHOOSE -directive was used to select that section.
Section names are case insensitive.
%.pg
You can use different configuration statements in the file, some
You can use different configuration directives in the file, some
of which can be used multiple times.
In general, the statements are
In general, the directives are
written in capital letters, followed by an equals sign, followed by
settings particular to that statement.
settings particular to that directive.
%.pg
Here is a list of allowed statements:
Here is a list of allowed directives:
%.lp
\blist{}
@@ -3381,8 +3381,8 @@ take more diverse values.
Prefix a boolean option with `no' or `!' to turn it off.
For compound options, the option name and value are separated by a colon.
Some options are persistent, and apply only to new games.
You can specify multiple OPTIONS statements, and multiple options
separated by commas in a single OPTIONS statement.
You can specify multiple OPTIONS directives, and multiple options
separated by commas in a single OPTIONS directive.
(Comma separated options are processed from right to left.)
%.lp ""
@@ -3461,7 +3461,8 @@ Example:
%.lp
\item[\bb{CHOOSE}]
Chooses at random one of the comma-separated parameters as an active
section name. Lines in other sections are ignored.
section name.
Lines in other sections are ignored.
%.lp ""
Example:
@@ -3473,9 +3474,18 @@ Example:
OPTIONS=role:arc,race:dwa,align:law,gender:fem
[char B]
OPTIONS=role:wiz,race:elf,align:cha,gender:mal
END-CHOOSE
OPTIONS=!rest_on_space
\end{verbatim}
%.ed
%.lp
\item[\bb{END-CHOOSE}]
An optional way to terminate CHOOSE.
You can place an END-CHOOSE directive after the last CHOOSE section in
order to follow that with other options which are common to all sections.
Otherwise the last section extends to the end of the options file.
%.lp
\item[\bb{MENUCOLOR}]
Highlight menu lines with different colors.
@@ -3592,10 +3602,10 @@ to that shell), or the pair of commands
%.pg
The NETHACKOPTIONS value is effectively the same as a single OPTIONS
statement in a configuration file.
directive in a configuration file.
The ``OPTIONS='' prefix is implied and comma separated options are
processed from right to left.
Other types of configuration statements such as BIND or MSGTYPE are
Other types of configuration directives such as BIND or MSGTYPE are
not allowed.
%.pg
@@ -4745,7 +4755,7 @@ returns to {\it NetHack\/} to help compensate for international keyboard
issues.
OPTIONS=subkeyvalue:171/92
will return 92 to {\it NetHack\/}, if 171 was originally going to be returned.
You can use multiple subkeyvalue statements in the configuration file
You can use multiple subkeyvalue assignments in the configuration file
if needed.
Cannot be set with the `{\tt O}' command.
%.lp