Difference between revisions of "Template:Align Silver"

From RimWorld Wiki
Jump to navigation Jump to search
(work in progress)
 
Line 1: Line 1:
<includeonly>{{#ifexpr: {{#vardefineecho:silver|{{formatnum:{{{1|}}}|R}}}} < 1000000 | {{#ifexpr: {{{2|5}}} > 6 | {{0|0,}} }} }}{{#ifexpr: {{#var:silver}} < 100000 | {{#ifexpr: {{{2|5}}} > 5 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 10000 | {{#ifexpr: {{{2|5}}} > 4 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 1000 | {{#ifexpr: {{{2|5}}} > 3 | {{0|0,}} }} }}{{#ifexpr: {{#var:silver}} < 100 | {{#ifexpr: {{{2|5}}} > 2 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 10 | {{#ifexpr: {{{2|5}}} > 1 | {{0}} }} }}{{formatnum:{{{1|}}}}}{{padright: {{{1|}}} | {{#expr: {{{2|5}}} + {{{3|2}}} }} |{{0}}}}</includeonly><noinclude>
+
<includeonly>{{#ifexpr: {{#vardefineecho:silver|{{formatnum:{{{1|}}}|R}}}} < 1000000 | {{#ifexpr: {{{2|5}}} > 6 | {{0|0,}} }} }}{{#ifexpr: {{#var:silver}} < 100000 | {{#ifexpr: {{{2|5}}} > 5 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 10000 | {{#ifexpr: {{{2|5}}} > 4 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 1000 | {{#ifexpr: {{{2|5}}} > 3 | {{0|0,}} }} }}{{#ifexpr: {{#var:silver}} < 100 | {{#ifexpr: {{{2|5}}} > 2 | {{0}} }} }}{{#ifexpr: {{#var:silver}} < 10 | {{#ifexpr: {{{2|5}}} > 1 | {{0}} }} }}{{formatnum:{{{1|}}}}}{{#ifexpr: {{{1|}}} fmod 1 = 0 | {{#ifexpr: {{{3|2}}} > 0 | {{0|,0}} }} }}{{#ifexpr: {{{1|}}} fmod 1 >= 0.1 or {{{1|}}} fmod 1 = 0 | {{#ifexpr: {{{3|2}}} > 1 | {{0}} }} }}</includeonly><noinclude>{{Documentation}}</noinclude>
{{Documentation}}{{Align Silver|100}}{{Icon Small|silver}}
 
</noinclude>
 

Revision as of 17:10, 20 September 2022

Documentation icon Template documentation[view] [edit] [history] [purge]

Summary

This table can be used to align values of silver. This might be useful in tables and lists. It has three parameters:

  • The first parameter is the amount of silver.
  • The second parameter is the expected maximum power of ten of the first parameter. (default = 5; maximum 2)
  • The third parameter is the expected number of decimal places. (default = 2; maximum 2)

Examples

{{Align Silver|1|2}}
{{Align Silver|10|2}}

01,00

10,00

Default length is five:

{{Align Silver|1,000}}
{{Align Silver|10,000}}
{{Align Silver|100,000}}

01,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

10,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

100,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

Maximum length is seven:

{{Align Silver|1|7}}
{{Align Silver|10|7}}
{{Align Silver|100|7}}
{{Align Silver|1,000|7}}
{{Align Silver|10,000|7}}
{{Align Silver|100,000|7}}
{{Align Silver|1,000,000|7}}

0,000,001,00

0,000,010,00

0,000,100,00

0,001,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

0,010,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

0,100,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

1,000,000Expression error: Unrecognized punctuation character ",".Expression error: Unrecognized punctuation character ",".

Decimal places:

{{Align Silver|10|3|2}} {{Icon Small|silver}}
{{Align Silver|1|3|2}} {{Icon Small|silver}}
{{Align Silver|0.1|3|2}} {{Icon Small|silver}}
{{Align Silver|100.01|3|2}} {{Icon Small|silver}}
{{Align Silver|0.001|3|2}} {{Icon Small|silver}}

010,00 Silver

001,00 Silver

000.10 Silver

100.01 Silver

000.001 Silver