Status hilites

From NetHackWiki
Revision as of 22:25, 28 May 2018 by TK (talk | contribs) (Incomplete sentence)
Jump to navigation Jump to search

Status hilites are a feature added in NetHack 3.6 that allows the player to configure the display colors of status indicators and conditions.

In 3.6.0, it was considered an experimental feature and was not compiled in by default, and it was improved greatly in NetHack 3.6.1.

NetHack 3.6.1

First, there is an option called statushilites, which is numeric. It controls the number of turns for which most statuses will be hilighted after a change, after which they will revert to normal. Negating this or setting it to zero disables status hilites completely.

OPTIONS=statushilites:10 # will hilite changes in status for 10 turns
OPTIONS=!statushilites   # disables
OPTIONS=statushilites:0  # disables

Then, there are a number of options for configuring the hilites themselves. The general format is:

OPTIONS=hilite_status:field/trigger/color[&attributes]
OPTIONS=hilite_status:field/trigger/color[&attributes]/othercolor[&otherattributes]
OPTIONS=hilite_status:field/trigger/color[&attributes]/trigger2/color2[&attributes2]/trigger3[&attributes3]/...

The field is the value you wish to color.

The trigger sets the conditions where the hilite displays. (You can leave out the trigger entirely in order to set the "always" trigger.)

The color and attributes control what it displays as when the trigger is active. Note that hilite_status will display colors regardless of whether you have the color option enabled.

Fields

Available triggers for each field are tabulated below. Note that there is one other trigger, "always", which is not listed because it should work for every field.

Field Description up / down / changed percentage absolute value* text match Notes
title Your rank title. Yes Yes Comparisons are based on the strings used, not your experience level, so going from an XL 1 "Rambler" to an XL 3 "Sightseer" will count as a decrease.
strength Your strength. Yes Yes When specifying absolute values, 1-18 are per normal. Then, 18/01 is actually 19, 18/02 is actually 20, and so on through 18/99 being actually 118, as far as hilite_status is concerned. 19 strength corresponds to 119, and so on all the way up to 25 strength corresponding to 125.
dexterity, constitution, intelligence, wisdom, charisma Your other ability scores. Yes Yes
characteristics Is an alias for all six ability scores. Yes Yes
alignment Your alignment (Lawful, Neutral, or Chaotic). Yes Yes The ordering is Lawful < Neutral < Chaotic if you want to use up or down rules. Text matches must be either "Lawful", "Neutral", or "Chaotic".
score Your score. Yes Yes
carrying-capacity Your encumbrance status. Yes Yes Text matches must be either "Burdened", "Stressed", "Strained", "Overtaxed", or "Overloaded".
gold Gold in open inventory. Yes Yes
power Your energy. Yes Yes Yes
power-max Your maximum energy. Yes Yes
experience-level Your experience level. Yes Yes
armor-class Your armor class. Yes Yes Since armor class gets better as it decreases, the trigger for a "good" change is down and the trigger for a "bad" change is up.
HD Your hit dice (shown only when you are polymorphed). Yes Yes
time The current turn count. Yes Yes
hunger Your hunger level. Yes Yes
hitpoints Your hit points. Yes Yes Yes
hitpoints-max Your maximum hit points. Yes Yes
dungeon-level The dungeon level. Yes Yes
experience Your experience points (not the level). Yes Yes
condition Any of the various status conditions or afflictions. No normal triggers work, not even always. See below.

Triggers

The available triggers are:

  • always: Always apply the hilight. Never times out.
  • up: Trigger when the value increases, times out.
  • down: Trigger when the value decreases, times out.
  • changed: Trigger when the value changes in any way, times out.
  • N%: Trigger when the value is equal to N% of maximum. Also works when prefixed with < or > to match any value greater than or less than this percentage. Only works for hitpoints and power. Does not time out.
  • N (some numerical amount): Trigger when the value is equal to N. Also works when prefixed with < or > to match any value greater than or less than this percentage. Does not time out.
  • string: Trigger when the value's text matches this string. Case-insensitive. Only works on a few fields. Does not time out.

Note that when the < or > operators are used, they mean "less than or equal", and not "strictly less than".

The triggers which work specifically for the condition field are:

  • stone, slime, strngl, foodpois, termill, blind, deaf, stun, conf, hallu, lev, fly, and ride: set any of these conditions specifically
  • major_troubles: alias for stone, slime, strngl, foodpois, and termill
  • minor_troubles: alias for blind, deaf, stun, conf, and hallu
  • movement: alias for lev, fly, and ride
  • all: alias for anything

Note that the aliases will override any specific status effect, but "all" will be overridden by the other aliases.

Colors

The following colors are valid: black, red, green, brown, blue, magenta, cyan, gray, orange, lightgreen, yellow, lightblue, lightmagenta, lightcyan, and white.

They can be combined with the following attributes by using an & sign: bold, inverse, underline, blink, dim, and normal. (Your terminal may not render some of these properly.)

Examples

# Ensure changes will be shown for a few turns after they happen.
OPTIONS=statushilites:10

# Always show gold as the proper color.
OPTIONS=hilite_status:gold/always/yellow

# Show when the character is Lawful, for some reason.
OPTIONS=hilite_status:alignment/lawful/green&bold
# the above line is equivalent to:
OPTIONS=hilite_status:alignment/lawful/lightgreen

# Show when XL changes.
OPTIONS=hilite_status:experience-level/changed/white/cyan
# the above line is equivalent to:
OPTIONS=hilite_status:experience-level/changed/white/always/cyan

# Specify multiple cutoffs for all ability scores.
OPTIONS=hilite_status:characteristics/<5/red
OPTIONS=hilite_status:characteristics/>6/orange
OPTIONS=hilite_status:characteristics/>8/brown
OPTIONS=hilite_status:characteristics/>11/yellow
OPTIONS=hilite_status:characteristics/>13/green
OPTIONS=hilite_status:characteristics/>16/cyan
OPTIONS=hilite_status:characteristics/>18/lightblue
# the above lines are equivalent to:
OPTIONS=hilite_status:characteristics/<5/red/>6/orange/>8/brown/>11/yellow/>13/green/>16/cyan/>18/lightblue

# Hilight multiple encumbrance statuses.
OPTIONS=hilite_status:carrying-capacity/burdened/yellow/stressed/orange

# Percentage cutoffs for hitpoints.
OPTIONS=hilite_status:hitpoints/100%/brightgreen
OPTIONS=hilite_status:hitpoints/<100%/green
OPTIONS=hilite_status:hitpoints/<60%/yellow
OPTIONS=hilite_status:hitpoints/<40%/red

NetHack 3.6.0

The information in this section is based primarily on reading the source. Due to a bug and some other minor limitations, some things cannot be tested.

Specification

Hilite_status is specified like other options, and takes this form:

OPTIONS=hilite_status:field/threshold/down-color/up-color

The field is the value you wish to color.

The threshold is the value over which it will be displayed as up-color and under which it will be displayed as down-color, or the special operator "updown".

Up-color and down-color define these colors.

Only one threshold, and two colors, are currently allowed.

Valid fields

These fields mean and behave exactly what and how you'd expect: dexterity, constitution, intelligence, wisdom, charisma, score, gold, power, power-max, armor-class, time, hitpoints, and hitpoints-max.

However, hilite_status uses the game's internal representation of your attributes, which results in some counterintuitive quirks for other fields. These need a little explanation:

  • strength is, of course, your current strength stat.
  • experience-level is your current character level. experience is your total XP. The latter isn't displayed at all unless showexp is enabled.
  • HD: When you are polymorphed into a monster, your character level display is replaced with the monster level (aka "hit dice") of your polymorphed form.
  • carrying-capacity is 0 if unencumbered (in which case it won't be visible at all), 1 if burdened, 2 if stressed, 3 strained, 4 overtaxed, 5 overloaded.
  • hunger is 0 if satiated, 1 if not hungry (not shown on UI), 2 if hungry, 3 weak, 4 fainting, 5 fainted (as in actually unconscious from lack of food), and 6 starved. Despite of "hungry" being bigger than "satiated", if you want a yellow color when you are hungry the right syntax is "hunger/2/yellow/normal", not "hunger/2/normal/yellow".

Thresholds are not allowed for title, alignment, and dungeon-level. So, you cannot have different colors for different alignments, and you cannot highlight being above/below a certain level of the dungeon. The only allowed comparison is "updown"; when they change, they are highlighted as if they went up.

condition is special. It is a bitmask comprised of the following flags:

  • 0x01 (1) : Blind
  • 0x02 (2) : Confused
  • 0x04 (4) : Food Poisoned
  • 0x08 (8) : Ill
  • 0x10 (16): Hallucinating
  • 0x20 (32): Stunned
  • 0x40 (64): Sliming

You are considered "over" if you have any of the statuses in the bitmask you specify and "under" if not. To make your bitmask, take your desired conditions in the table above and add their numbers together. "updown" will highlight as its "up" color when you gain any status, and as its "down" color when you lose any status. (Note that it won't be visible when all your status afflictions disappear, because then there is no text to highlight.)

Thresholds

A user has suggested improving this page or section as follows:

"Many (most?) fields don't work correctly with downup. gold, for one."

Thresholds can be one of these types:

  • An arbitrary number (e.g. "40"). If the field is equal to or less than the number specified, it will be hilighted as the down-color; otherwise, it will be hilighted as the up-color.
    NetHack 3.6.0 contains a bug where thresholds of this type cannot be set via a config file. It has been fixed in 3.6.1. A workaround is to set these via the options menu in-game.
  • A percentage (e.g. "25%"). This is only valid for the hitpoints and power fields, and is the same as an arbitrary number except that the threshold is a certain percentage of that value's maximum instead of a specific number.
  • The special value updown. The value will be hilighted down-color if it decreases, and up-color if it increases; the rest of the time, it will be displayed normally. The game also recognizes downup, up, and down, but they are treated as synonyms and do not change the order or meaning of the colors.
  • The parser also recognizes a changed threshold, but it is currently unimplemented, likely because updown would make it redundant.

Colors

The following colors are valid: "red", "green", "brown", "blue", "magenta", "cyan", "gray", "orange", "bright-green", "yellow", "bright-blue", "bright-magenta", "bright-cyan", and "white".

You can also specify "bold", "inverse" or "normal" as colors, which have the respective effect on white text. They can't be combined with any of the colors.

"Black" and "transparent" also appear to be valid, but don't do anything.

Compiling

To play 3.6.0 with hilite_status enabled, you will probably need to compile it yourself in order to play with it locally. Most distributions of NetHack 3.6.0 likely have it disabled.

3.6.1 currently has it enabled by default, but this may change. (And since there aren't any distributions of it yet, you currently have to compile it to play locally anyway.)

To do this, go into config.h and uncomment the following lines:

#define STATUS_VIA_WINDOWPORT /* re-work of the status line
                                 updating process */
#define STATUS_HILITES        /* support hilites of status fields */

After this, you should be able to compile normally.


This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.1. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-361}} tag to the current version's tag or {{noversion}} as appropriate.