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!

(At the moment, half a heart = 0.5hp)
(Half a heart = 1hp)
Line 1: Line 1:
{{{1}}} ({{#ifexpr: {{{1}}} > 0 and {{{1}}} < 10 or {{{1}}} = 10 or {{{1}}} = 0|{{#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}}} = 0 or {{{1}}} < 0 | [[File:ui-health-empty.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]]}}}}|{{{1}}} × [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}})<noinclude>
+
{{{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|link=Health]] | {{#ifexpr: {{{1}}} = 1.5 or {{{1}}} > 1.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} = 0 or {{{1}}} < 0 | [[File:ui-health-empty.png|12x12px|class=item-icon pixel|link=Health]]}}}}}}{{#ifexpr: {{{1}}} > 2.5 and {{{1}}} < 3.5 or {{{1}}} = 2.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 3.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 4.5 and {{{1}}} < 5.5 or {{{1}}} = 4.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 5.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 6.5 and {{{1}}} < 7.5 or {{{1}}} = 6.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 7.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 8.5 and {{{1}}} < 9.5 or {{{1}}} = 8.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 9.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 10.5 and {{{1}}} < 11.5 or {{{1}}} = 10.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 11.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 12.5 and {{{1}}} < 13.5 or {{{1}}} = 12.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 13.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 14.5 and {{{1}}} < 15.5 or {{{1}}} = 14.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 15.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 16.5 and {{{1}}} < 17.5 or {{{1}}} = 16.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 17.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}{{#ifexpr: {{{1}}} > 18.5 and {{{1}}} < 19.5 or {{{1}}} = 18.5 | [[File:ui-health-half.png|12x12px|class=item-icon pixel|link=Health]] | {{#ifexpr: {{{1}}} > 19.5 and {{{1}}} < 20.01 or {{{1}}} = 20 | [[File:ui-health.png|12x12px|class=item-icon pixel|link=Health]]}}}}|{{#expr: {{{1}}} / 2}} × [[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.
Line 18: Line 18:
 
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9}}
 
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9}}
 
* <code><nowiki>{{Health|10}}</nowiki></code> → {{Health|10}}
 
* <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:
 
Rounding examples:

Revision as of 13:31, 5 July 2022

{{{1}}} (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}} → 0 (Ui-health-empty.png)
  • {{Health|1}} → 1 (Ui-health-half.png)
  • {{Health|2}} → 2 (Ui-health.png)
  • {{Health|3}} → 3 (Ui-health.pngUi-health-half.png)
  • {{Health|4}} → 4 (Ui-health.pngUi-health.png)
  • {{Health|5}} → 5 (Ui-health.pngUi-health.pngUi-health-half.png)
  • {{Health|6}} → 6 (Ui-health.pngUi-health.pngUi-health.png)
  • {{Health|7}} → 7 (Ui-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|8}} → 8 (Ui-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|9}} → 9 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|10}} → 10 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|11}} → 11 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|12}} → 12 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|13}} → 13 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|14}} → 14 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|15}} → 15 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|16}} → 16 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|17}} → 17 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|18}} → 18 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)
  • {{Health|19}} → 19 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|20}} → 20 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.png)

Rounding examples:

  • {{Health|1.25}} → 1.25 (Ui-health-half.png)
  • {{Health|1.5}} → 1.5 (Ui-health.png)
  • {{Health|1.75}} → 1.75 (Ui-health.png)

More than 10 health points:

  • {{Health|10.5}} → 10.5 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|15} → 15 (Ui-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health.pngUi-health-half.png)
  • {{Health|300}} → 300 (150 × Ui-health.png)