Difference between revisions of "Template:Health"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

(Size parameter now only needs a number for it to work (see last example in the documentation))
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{{1}}} ({{#ifexpr: {{{1}}} > 0 and {{{1}}} < 20 or {{{1}}} = 20 or {{{1}}} = 0|{{#ifexpr: {{{1}}} > 0 and {{{1}}} < 1.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} = 1.5 or {{{1}}} > 1.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} = 0 or {{{1}}} < 0 | [[File:ui-health-empty.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}}}{{#ifexpr: {{{1}}} > 2.5 and {{{1}}} < 3.5 or {{{1}}} = 2.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 3.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 4.5 and {{{1}}} < 5.5 or {{{1}}} = 4.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 5.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 6.5 and {{{1}}} < 7.5 or {{{1}}} = 6.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 7.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 8.5 and {{{1}}} < 9.5 or {{{1}}} = 8.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 9.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 10.5 and {{{1}}} < 11.5 or {{{1}}} = 10.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 11.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 12.5 and {{{1}}} < 13.5 or {{{1}}} = 12.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 13.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 14.5 and {{{1}}} < 15.5 or {{{1}}} = 14.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 15.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 16.5 and {{{1}}} < 17.5 or {{{1}}} = 16.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 17.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 18.5 and {{{1}}} < 19.5 or {{{1}}} = 18.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} > 19.5 and {{{1}}} < 20 or {{{1}}} = 20 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}}}}|{{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} heart{{#ifexpr: {{{1}}} = 1||s}}]]}})<noinclude>
+
<includeonly>{{#switch: {{{1}}}
== About ==
+
| 0 = 0 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-empty.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|0 hearts]])
This template serves to display health points in a page.
+
| 1 = 1 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-half.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|0.5 hearts]])
 
+
| 2 = 2 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|1 heart]])
== Usage ==
+
| 3 = 3 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|1.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-half.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|1.5 hearts]])
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.
+
| 4 = 4 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|2 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|2 hearts]])
 
+
| 5 = 5 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-half.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|2.5 hearts]])
== Examples ==
+
| 6 = 6 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3 hearts]])
* <code><nowiki>{{Health|0}}</nowiki></code> → {{Health|0}}
+
| 7 = 7 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-half.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|3.5 hearts]])
* <code><nowiki>{{Health|1}}</nowiki></code> → {{Health|1}}
+
| 8 = 8 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4 hears]])
* <code><nowiki>{{Health|2}}</nowiki></code> → {{Health|2}}
+
| 9 = 9 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}-half.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|4.5 hearts]])
* <code><nowiki>{{Health|3}}</nowiki></code> → {{Health|3}}
+
| 10 = 10 ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|5 hearts]])
* <code><nowiki>{{Health|4}}</nowiki></code> → {{Health|4}}
+
| #default = {{{1}}} ([[File:ui-health{{#ifeq: {{{hardcore}}}|true|-hardcore}}.png|{{{2|12}}}x{{{2|12}}}px|class=item-icon pixel|alt=♥|link=|1 heart]] × {{#expr: {{{1}}} / 2}})
* <code><nowiki>{{Health|5}}</nowiki></code> → {{Health|5}}
+
}}</includeonly><noinclude>
* <code><nowiki>{{Health|6}}</nowiki></code> → {{Health|6}}
+
{{Documentation}}
* <code><nowiki>{{Health|7}}</nowiki></code> → {{Health|7}}
+
<!-- Put categories/interwiki on the documentation page. -->
* <code><nowiki>{{Health|8}}</nowiki></code> → {{Health|8}}
 
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9}}
 
* <code><nowiki>{{Health|10}}</nowiki></code> → {{Health|10}}
 
* <code><nowiki>{{Health|11}}</nowiki></code> → {{Health|11}}
 
* <code><nowiki>{{Health|12}}</nowiki></code> → {{Health|12}}
 
* <code><nowiki>{{Health|13}}</nowiki></code> → {{Health|13}}
 
* <code><nowiki>{{Health|14}}</nowiki></code> → {{Health|14}}
 
* <code><nowiki>{{Health|15}}</nowiki></code> → {{Health|15}}
 
* <code><nowiki>{{Health|16}}</nowiki></code> → {{Health|16}}
 
* <code><nowiki>{{Health|17}}</nowiki></code> → {{Health|17}}
 
* <code><nowiki>{{Health|18}}</nowiki></code> → {{Health|18}}
 
* <code><nowiki>{{Health|19}}</nowiki></code> → {{Health|19}}
 
* <code><nowiki>{{Health|20}}</nowiki></code> → {{Health|20}}
 
 
 
Rounding examples:
 
* <code><nowiki>{{Health|1.25}}</nowiki></code> → {{Health|1.25}}
 
* <code><nowiki>{{Health|1.5}}</nowiki></code> → {{Health|1.5}}
 
* <code><nowiki>{{Health|1.75}}</nowiki></code> → {{Health|1.75}}
 
 
 
More than 20 health points:
 
* <code><nowiki>{{Health|20.5}}</nowiki></code> → {{Health|20.5}}
 
* <code><nowiki>{{Health|30}</nowiki></code> → {{Health|30}}
 
* <code><nowiki>{{Health|600}}</nowiki></code> → {{Health|600}}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 14:07, 11 July 2023

Template-info.png Template documentation Note: parts of or the entire template might not be visible without values provided.

This template serves to display health points in a page.

Usage

The syntax of this template is {{Health|<number>|<size>?|hardcore=true?}}. If the value is higher than 10, it will display n × <health> where n is the number you specified.

Examples

  • {{Health|0}} → 0 (♥)
  • {{Health|1}} → 1 (♥)
  • {{Health|2}} → 2 (♥)
  • {{Health|3}} → 3 (♥♥)
  • {{Health|4}} → 4 (♥♥)
  • {{Health|5}} → 5 (♥♥♥)
  • {{Health|6}} → 6 (♥♥♥)
  • {{Health|7}} → 7 (♥♥♥♥)
  • {{Health|8}} → 8 (♥♥♥♥)
  • {{Health|9}} → 9 (♥♥♥♥♥)
  • {{Health|10}} → 10 (♥♥♥♥♥)

Hardcore variants:

  • {{Health|0|hardcore=true}} → 0 (♥)
  • {{Health|1|hardcore=true}} → 1 (♥)
  • {{Health|2|hardcore=true}} → 2 (♥)
  • {{Health|100|hardcore=true}} → 100 (♥ × 50)

Rounding examples:

  • {{Health|1.25}} → 1.25 (♥ × 0.625)
  • {{Health|1.5}} → 1.5 (♥ × 0.75)
  • {{Health|1.75}} → 1.75 (♥ × 0.875)

More than 10 health points:

  • {{Health|20.5}} → 10.5 (♥ × 5.25)
  • {{Health|30} → 30 (♥ × 15)
  • {{Health|600}} → 600 (♥ × 300)

Custom icon size:

  • {{Health|6|16}} → 6 (♥♥♥)