Skip to content

CurrencyDefinition ​

Inherits: DatabaseResource < Resource

CurrencyDefinition defines a currency type with display properties and limits Create instances as .tres files for each currency (gold, gems, credits, etc.)

Properties ​

intmax_value0
Stringabbreviation"":
Stringplural_name"":
boolshow_in_wallettrue

Methods ​

boolis_valid()
Array[Dictionary]validate()
boolis_valid_amount( amount: int )
intclamp_amount( amount: int )
boolhas_max_limit()
Stringformat_amount( amount: int )
Stringget_name_for( amount: int )
intget_id()
Dictionaryget_currency_info()
Stringget_full_description()

Property descriptions ​

Currency Properties

int max_value = 0 ​

Maximum amount that can be held (0 = unlimited)

String abbreviation = "": ​

Short form for display (e.g., "GP", "G", "$")

String plural_name = "": ​

The name when the amount is not 1 ("Coins" for the currency "Coin"). Empty = the name is the same for every amount. Shown when there is no abbreviation

bool show_in_wallet = true ​

Is the currency listed with the money of the player (the inventory window, the trainer)? Off for a currency that only counts something for a quest or a system (the meat a quest asks for): it is held and counted all the same, the player does not see it

Method descriptions ​

bool is_valid() ​

Is it free of errors?

Array[Dictionary] validate() ​

Checks the settings. Gives the problems found (empty when it is fine).

bool is_valid_amount( amount: int ) ​

Check if an amount is valid for this currency

int clamp_amount( amount: int ) ​

Clamp an amount to valid range for this currency

bool has_max_limit() ​

Check if this currency has a maximum limit

String format_amount( amount: int ) ​

Get the display text for an amount of this currency

String get_name_for( amount: int ) ​

The name of the currency for an amount: the plural name when there is one and the amount is not 1, else the name

int get_id() ​

Get ID from filename

Dictionary get_currency_info() ​

Get currency info for debugging/display

String get_full_description() ​

Get full description including limits