Template:Reagent: Difference between revisions

From Space Station 14 Wiki
Aliser (talk | contribs)
Created page with "<includeonly>{{{1}}}{{#if: {{{2|}}}|<nowiki> </nowiki>[{{{2}}}u]}}</includeonly><noinclude> {{docs}} Category:Chemistry templates <templatedata> { "params": { "1": { "label": "Reagent", "description": "Reagent name, lowercase.", "example": "nutriment", "type": "line", "required": true }, "2": { "label": "Amount", "description": "A \"u\" suffix will be added automatically.", "example": "17", "type": "number", "suggested": true }..."
 
Aliser (talk | contribs)
test
Line 1: Line 1:
<includeonly>{{{1}}}{{#if: {{{2|}}}|<nowiki> </nowiki>[{{{2}}}u]}}</includeonly><noinclude>
<includeonly>{{{1}}}{{#if: {{{2|}}}|<nowiki> </nowiki>[{{{2}}}u]}}<!--
 
-->{{#if: {{{2|}}}|{{#vardefine:__solution_count__|{{#expr:{{#var:__solution_count__|0}} + {{{2}}}}}<!---->}}<!---->}}</includeonly><noinclude>
{{docs}}
{{docs}}



Revision as of 05:50, 4 April 2025

Template documentation
view or edit this documentation about template documentation

Usage

{{reagent|<name>|<optional amount>}}
or
{{r|<name>|<optional amount>}}

Example

{{reagent|nutriment|13}}
or
{{r|nutriment|13}}

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

  • Nutriment [6u]
  • Amatoxin [3u]
  • Vitamin [4u]

Total: 13

  • Vitamin [10u]

Total: 23

<reset>

Total: 0

Produces a reagent label with an optional amount.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Reagent1

Reagent name, lowercase.

Example
nutriment
Linerequired
Amount2

A "u" suffix will be added automatically.

Example
17
Numbersuggested