Template:Construction: Difference between revisions
Making a new template for construction goods since we use this all over the place |
m Trying to diagnose the blank space |
||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly>{| class="wikitable" | ||
! Amount !! Material | |||
|- | |||
{{#if:{{{1|}}}|<tr><td>'''{{{1}}}'''</td><td>{{rl|Planks|med}}</td></tr>}} | |||
{{#if:{{{Planks|}}}|<tr><td>'''{{{Planks}}}'''</td><td>{{rl|Planks|med}}</td></tr>}} | {{#if:{{{Planks|}}}|<tr><td>'''{{{Planks}}}'''</td><td>{{rl|Planks|med}}</td></tr>}} | ||
{{#if:{{{2|}}}|<tr><td>'''{{{2}}}'''</td><td>{{rl|Bricks|med}}</td></tr>}} | {{#if:{{{2|}}}|<tr><td>'''{{{2}}}'''</td><td>{{rl|Bricks|med}}</td></tr>}} | ||
| Line 6: | Line 9: | ||
{{#if:{{{Fabric|}}}|<tr><td>'''{{{Fabric}}}'''</td><td>{{rl|Fabric|med}}</td></tr>}} | {{#if:{{{Fabric|}}}|<tr><td>'''{{{Fabric}}}'''</td><td>{{rl|Fabric|med}}</td></tr>}} | ||
{{#if:{{{4|}}}|<tr><td>'''{{{4}}}'''</td><td>{{rl|Parts|med}}</td></tr>}} | {{#if:{{{4|}}}|<tr><td>'''{{{4}}}'''</td><td>{{rl|Parts|med}}</td></tr>}} | ||
{{#if:{{{Parts|}}}|<tr><td>'''{{{Parts}}}'''</td><td>{{rl|Parts|med}}</td></tr>}} | {{#if:{{{Parts|}}}|<tr><td>'''{{{Parts}}}'''</td><td>{{rl|Parts|med}}</td></tr>}} | ||
|}</includeonly><noinclude> | |||
== Overview == | == Overview == | ||
A template to populate small, well-aligned tables of construction goods. | A template to populate small, well-aligned tables of construction goods. | ||
== Parameters == | == Parameters == | ||
Revision as of 16:10, 28 November 2023
Overview
A template to populate small, well-aligned tables of construction goods.
Parameters
You may elect to name the parameters explicitly (Planks=) or use them in the order specified in the table:
| Parameter | Type | Description |
|---|---|---|
| Planks | Number | The number of |
| Bricks | Number | The number of |
| Fabric | Number | The number of |
| Parts | Number | The number of |
Examples
This table shows all possible values. {{Construction|Planks=12|Bricks=8|Fabric=4|Parts=2}} yields:
| Amount | Material |
|---|---|
| 12 | [Resource Link size not valid: med] |
| 8 | [Resource Link size not valid: med] |
| 4 | [Resource Link size not valid: med] |
| 2 | [Resource Link size not valid: med] |
Alternatively, you do not have to name the parameters. {{Construction|12|8|4|2} yields the same thing:
| Amount | Material |
|---|---|
| 12 | [Resource Link size not valid: med] |
| 8 | [Resource Link size not valid: med] |
| 4 | [Resource Link size not valid: med] |
| 2 | [Resource Link size not valid: med] |
You can also mix naming and not-naming to make it easier to write when skipping over building materials. {{Construction|8|Parts=2}} yields:
| Amount | Material |
|---|---|
| 8 | [Resource Link size not valid: med] |
| 2 | [Resource Link size not valid: med] |
Errors
This template does not result in any errors. However, there is no use for a template called without parameters.
{{Construction}}
Yields:
| Amount | Material |
|---|
(It's there, but it's a blank table.)
The template also does not prevent you from mixing both named and unnamed parameters, but the result will be confusing to readers.
{{Construction||10|Bricks=12}}
Yields:
| Amount | Material |
|---|---|
| 10 | [Resource Link size not valid: med] |
| 12 | [Resource Link size not valid: med] |


