HUD Stats
HUD Stats are number values that automatically appear in the HUD at the top right of the screen and can be controlled via game scripts.
HUD Stats config
yaml
hudStats:
money:
icon: img/ui/money.webp
name: Money
startingValue: 10
minValue: 0
energy:
icon: img/ui/energy.webp
name: Energy
startingValue: 10
minValue: 0
maxValue: 10
Stats are defined in the hudStats
part of the config.
icon:
path to an image to use as the icon for the statname
: The name of the stat for display in the HUDstartingValue
: The default value for the stat on a new saveminValue [optional, default 0]
: How low this stat can gomaxValue [optional]
: How high this stat can godecimals [optional, default 2]
: Number, how many decimals to keep when rounding the stat valueprefix [optional]
: A prefix to add before the stat value when displaying it. If there is neither a prefix or a suffix, the name will be shown before the stat valuesuffix [optional]
: A suffix to add after the stat value when displaying it. If there is neither a prefix or a suffix, the name will be shown before the stat valuehideName [optional, default false]
: If set to true, the curreny name will not be shown, regardless of whether there is a prefix or suffixformatting [optional]
: See next section
Advanced formatting
Using styling options of web standard Intl.NumberFormat
, stats can automatically be formatted in a few common formats via the formatting
option.
If the formatting
option is present, it needs to be an object with at least a style
value. The following styles are supported: decimal
(default), currency
, percent
, unit
.
currency
: If style is set tocurrency
, then thecurrency
option can be provided in theformatting
object to choose a currency. Default is USD.unit
: If style is set tounit
, then theunit
option can be provided in theformatting
object to choose a unit. Default isday
.percent
: There is nothing special to do for this one, but the number should be between 0 and 1.
Examples of advanced formatting
Details
yaml
hudStats:
money:
icon: img/ui/money.webp
name: Money
startingValue: 10
minValue: 0
maxValue: 99999
decimals: 2
hideName: true
formatting:
style: currency
currency: USD
energy:
icon: img/ui/energy.webp
name: Energy
startingValue: 10
minValue: 0
maxValue: 10
suffix: ' / 10'
decimals: 0
percent:
icon: img/ui/energy.webp
name: percent
hideName: true
startingValue: 0.5
minValue: 0
maxValue: 1
formatting:
style: percent
days:
icon: img/ui/energy.webp
name: days
startingValue: 2
minValue: 0
maxValue: 7
hideName: true
formatting:
style: unit
unit: day