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

@@ -1,4 +1,4 @@
.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.393 $ $NHDT-Date: 1595731545 2020/07/26 02:45:45 $
.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.394 $ $NHDT-Date: 1596754607 2020/08/06 22:56:47 $
.\"
.\" This is an excerpt from the 'roff' man page from the 'groff' package.
.\" Guidebook.mn currently does *not* fully adhere to these guidelines.
@@ -35,7 +35,7 @@
.ds vr "NetHack 3.7
.ds f0 "\*(vr
.ds f1
.ds f2 "July 25, 2020
.ds f2 "August 5, 2020
.
.\" A note on some special characters:
.\" \(lq = left double quote
@@ -3138,16 +3138,16 @@ Any line beginning with \(oq[\(cq and ending in \(oq]\(cq 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 OPTIONS
There are two types of options, boolean and compound options.
Boolean options toggle a setting on or off, while compound options
@@ -3155,8 +3155,8 @@ take more diverse values.
Prefix a boolean option with \(lqno\(rq or \(oq!\(cq 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 ""
Example:
@@ -3220,7 +3220,8 @@ Example:
.ed
.lp 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:
.sd
@@ -3231,8 +3232,18 @@ CHOOSE=char A,char B
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
.ft \" revert to previous font
.ed
.lp END-CHOOSE
An optional way to terminate CHOOSE.
.\" use of the \% prefix prevents END-CHOOSE from being hyphenated across
.\" line boundary despite its hyphen; needed for the plain text output to
.\" avoid splitting the directive name
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 MENUCOLOR
Highlight menu lines with different colors.
See the \(lqConfiguring Menu Colors\(rq section.
@@ -3342,10 +3353,10 @@ to that shell), or the pair of commands
in \fIsh\fP, \fIksh\fP, or \fIbash\fP.
.pg
The NETHACKOPTIONS value is effectively the same as a single OPTIONS
statement in a configuration file.
directive in a configuration file.
The \(lqOPTIONS=\(rq 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
Instead of a comma-separated list of options,
@@ -4338,7 +4349,7 @@ May be used to alter the value of keystrokes that the operating system
returns to NetHack to help compensate for international keyboard issues.
OPTIONS=subkeyvalue:171/92
will return 92 to 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 \(oqO\(cq command.
.lp video