Template:Reagent: Difference between revisions
test |
replace [Nu] with {{u}} template (adds a cool beaker icon!) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{{1}}}{{#if: {{{2|}}}|<nowiki> </nowiki> | <includeonly>{{{1}}}{{#if: {{{2|}}}|<nowiki> </nowiki>{{u|{{{2}}}}}<nowiki></nowiki><!---->}}<!-- | ||
# increment solution count by the amount, if its defined | |||
-->{{#if: {{{2|}}}|{{#vardefine:__solution_count__|{{#expr:{{#var:__solution_count__|0}} + {{{2}}}}}<!---->}}<!---->}}</includeonly><noinclude> | -->{{#if: {{{2|}}}|{{#vardefine:__solution_count__|{{#expr:{{#var:__solution_count__|0}} + {{{2}}}}}<!---->}}<!---->}}</includeonly><noinclude> | ||
{{docs}} | {{docs}} | ||
Line 13: | Line 14: | ||
"example": "nutriment", | "example": "nutriment", | ||
"type": "line", | "type": "line", | ||
"required": true | "required": true, | ||
"suggestedvalues": [ | |||
"Nutriment", | |||
"Fat" | |||
] | |||
}, | }, | ||
"2": { | "2": { |
Latest revision as of 17:15, 26 May 2025
Usage
{{reagent
or
{{r
Example
{{reagent
or
{{r
↓
nutriment 13u
or
nutriment 13u
Automatic solution count
Every time the template is used on a page, it increments the internal counter for the total solution amount (units).
This total can be used to display, well, the total amount of a solution thus counted.
To use this, put {{Reset solution count}} before the count should start. This resets any previous count if there was any. Then, place your solutions with this template.
To retrieve the solution count, use {{Solution count}}.
Example
<reset> {{Reset solution count}}
Total: {{Solution count}}
* {{r|Nutriment|6}}
* {{r|Amatoxin|3}}
* {{r|Vitamin|4}}
Total: {{Solution count}}
* {{r|Vitamin|10}}
Total: {{Solution count}}
<reset> {{Reset solution count}}
Total: {{Solution count}}
↓
<reset>
Total: 0
Total: 13
Total: 23
<reset>
Total: 0Produces a reagent label with an optional amount.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Reagent | 1 | Reagent name, lowercase.
| Line | required |
Amount | 2 | A "u" suffix will be added automatically.
| Number | suggested |