Template:Coin/doc

From Fargo's Mods Wiki
Jump to navigation Jump to search

This template is used as a standardized way to display formatted coin values.

Usage

There are 2 API styles:

Style A

{{ coin | <Platinum Coins> (optional) | <Gold Coins> (optional) | <Silver Coins> (optional) | <Copper Coins> }}

Example: {{ coin | 1 | 0 | 30 }} means 1 Gold 30 Copper Coins.

Style B

{{ coin | <Platinum Coins>pc (optional) <Gold Coins>gc (optional) <Silver Coins>sc (optional) <Copper Coins>cc (optional) }}

Examples: {{ coin | 1gc30cc }} means 1 Gold 30 Silver Coins; {{ coin | 1.25gc }} means 1 Gold 25 Silver Coins.

Spacing and capitalization is ignored.

Other parameters

round

Digit to round the combined value to; default is 2. Can also be negative, and can be used with all API styles.

Examples

Code Result
{{coin|30}} 30 Platinum Coin.png
{{coin|1|30}} 1 Platinum Coin.png 30 Gold Coin.png
{{coin|1|1}} 1 Platinum Coin.png 1 Gold Coin.png
{{coin|1sc}} <span data-info="Expression error: Unrecognized word "sc"."> 1sc Platinum Coin.png
{{coin|10gc}} <span data-info="Expression error: Unrecognized word "gc"."> 10gc Platinum Coin.png
{{coin|100000cc}} <span data-info="Expression error: Unrecognized word "cc"."> 100000cc Platinum Coin.png
{{coin|100000}} 100000 Platinum Coin.png
{{coin|3|1|30}} 3 Platinum Coin.png 1 Gold Coin.png 30 Silver Coin.png
{{coin|3|0|1|30}} 3 Platinum Coin.png 1 Silver Coin.png 30 Copper Coin.png
{{coin|0|1|0|30}} 1 Gold Coin.png 30 Copper Coin.png
{{coin|1.30gc}} <span data-info="Expression error: Unrecognized word "gc"."> 1.30gc Platinum Coin.png
{{coin|12 gc 80cc}} <span data-info="Expression error: Unrecognized word "gc"."> 12 gc 80cc Platinum Coin.png
{{coin|12cc 80gc}} <span data-info="Expression error: Unrecognized word "cc"."> 12cc 80gc Platinum Coin.png
{{coin|130 SC}} <span data-info="Expression error: Unrecognized word "sc"."> 130 SC Platinum Coin.png
{{coin|1.5gc130sc}} <span data-info="Expression error: Unrecognized word "gc"."> 1.5gc130sc Platinum Coin.png
{{coin|1.0130gC}} <span data-info="Expression error: Unrecognized word "gc"."> 1.0130gC Platinum Coin.png
{{coin|32sc 57.8741cc}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|32sc 57.8741cc|round=3}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|32sc 57.8741cc|round=1}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|32sc 57.8741cc|round=0}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|32sc 57.8741cc|round=-1}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|32sc 54.9781cc|round=-1}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 54.9781cc Platinum Coin.png
{{coin|32sc 57.8741cc|round=-2}} <span data-info="Expression error: Unrecognized word "sc"."> 32sc 57.8741cc Platinum Coin.png
{{coin|14pc 56gc 32sc 57.8741cc|round=-6}} <span data-info="Expression error: Unrecognized word "pc"."> 14pc 56gc 32sc 57.8741cc Platinum Coin.png
{{coin|14pc 56gc 32sc 57.8741cc|round=-7}} <span data-info="Expression error: Unrecognized word "pc"."> 14pc 56gc 32sc 57.8741cc Platinum Coin.png
{{coin|14pc 56gc 32sc 57.8741cc|round=-8}} <span data-info="Expression error: Unrecognized word "pc"."> 14pc 56gc 32sc 57.8741cc Platinum Coin.png
{{coin|54pc 56gc 32sc 57.8741cc|round=-8}} <span data-info="Expression error: Unrecognized word "pc"."> 54pc 56gc 32sc 57.8741cc Platinum Coin.png

Note

  • This template is table-sorting-friendly (needs data-sort-type="number" in header). See the example table above or here.
  • It is only designed for positive numbers – negative values as input may lead to unexpected results.