Difference between revisions of "Template:Health"
Line 1: | Line 1: | ||
− | {{#ifexpr: {{{1}}} > 0 and {{{1}}} < 0.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 0.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 1.24 and {{{1}}} < 1.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 1.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 2.24 and {{{1}}} < 2.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 2.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 3.24 and {{{1}}} < 3.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 3.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 4.24 and {{{1}}} < 4.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 4.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 5.24 and {{{1}}} < 5.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 5.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 6.24 and {{{1}}} < 6.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 6.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 7.24 and {{{1}}} < 7.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 7.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 8.24 and {{{1}}} < 8.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 8.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 9.24 and {{{1}}} < 9.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 9.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}<noinclude> | + | {{#switch: {{{1}}} |
+ | | {{#ifexpr: {{{1}}} = 0 or {{{1}}} < 0}} = [[File:ui-health-empty.png|12x12px|class=item-icon pixel|link=Health]] | ||
+ | | {{#ifexpr: {{{1}}} > 10}} = {{{1}}} × [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]] | ||
+ | | #default = {{#ifexpr: {{{1}}} > 0 and {{{1}}} < 0.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 0.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 1.24 and {{{1}}} < 1.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 1.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 2.24 and {{{1}}} < 2.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 2.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 3.24 and {{{1}}} < 3.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 3.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 4.24 and {{{1}}} < 4.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 4.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 5.24 and {{{1}}} < 5.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 5.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 6.24 and {{{1}}} < 6.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 6.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 7.24 and {{{1}}} < 7.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 7.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 8.24 and {{{1}}} < 8.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 8.74 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 9.24 and {{{1}}} < 9.75 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 9.74 and {{{1}}} < 10.01 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}} | ||
+ | }}<noinclude> | ||
== About == | == About == | ||
This template serves to display health points in a page. | This template serves to display health points in a page. | ||
== Usage == | == Usage == | ||
− | The syntax of this template is <code><nowiki>{{Health|<number>}}</nowiki></code>. If the value given is <code>0</code> or lower, it will display | + | The syntax of this template is <code><nowiki>{{Health|<number>}}</nowiki></code>. If the value given is <code>0</code> or lower, it will display an empty heart icon, and if the value is higher than <code>10</code>, it will display <code><nowiki>n × <health></nowiki></code> where <code>n</code> is the number you specified. It can also round to the nearest integer. |
== Examples == | == Examples == | ||
Line 23: | Line 27: | ||
* <code><nowiki>{{Health|1.5}}</nowiki></code> → {{Health|1.5}} | * <code><nowiki>{{Health|1.5}}</nowiki></code> → {{Health|1.5}} | ||
* <code><nowiki>{{Health|1.75}}</nowiki></code> → {{Health|1.75}} | * <code><nowiki>{{Health|1.75}}</nowiki></code> → {{Health|1.75}} | ||
+ | |||
+ | More than 10 health points: | ||
+ | * <code><nowiki>{{Health|10.5}}</nowiki></code> → {{Health|10.5}} | ||
+ | * <code><nowiki>{{Health|15}</nowiki></code> → {{Health|15}} | ||
+ | * <code><nowiki>{{Health|300}}</nowiki></code> → {{Health|300}} | ||
</noinclude> | </noinclude> |
Revision as of 10:45, 5 July 2022
Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".Expression error: Unrecognized punctuation character "{".
About
This template serves to display health points in a page.
Usage
The syntax of this template is {{Health|<number>}}
. If the value given is 0
or lower, it will display an empty heart icon, and if the value is higher than 10
, it will display n × <health>
where n
is the number you specified. It can also round to the nearest integer.
Examples
{{Health|0}}
→{{Health|1}}
→{{Health|2}}
→{{Health|3}}
→{{Health|4}}
→{{Health|5}}
→{{Health|6}}
→{{Health|7}}
→{{Health|8}}
→{{Health|9}}
→{{Health|10}}
→
Rounding examples:
More than 10 health points: