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!

m
m (Testing fix health with .5 decimals)
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}} hearts]] | {{#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}}} = 2||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}}} = -2||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}} hearts]] | {{#ifexpr: {{{1}}} > 3.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 5.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 7.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 9.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 11.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 13.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 15.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 17.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} > 19.5 and {{{1}}} < 20 or {{{1}}} = 20 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}|{{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]]}})<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|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]] | {{#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}}} = 2||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}}} = -2||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}} hearts]] | {{#ifexpr: {{{1}}} = 3.5 or {{{1}}} > 3.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 5.5 or {{{1}}} > 5.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 7.5 or {{{1}}} > 7.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 9.5 or {{{1}}} > 9.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 11.5 or {{{1}}} > 11.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 13.5 or {{{1}}} > 13.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 15.5 or {{{1}}} > 15.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 17.5 or {{{1}}} > 17.5 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}{{#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}} hearts]] | {{#ifexpr: {{{1}}} = 19.5 or {{{1}}} > 19.5 and {{{1}}} < 20 or {{{1}}} = 20 | [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|{{#expr: {{{1}}} / 2}} hearts]]}}}}|{{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]]}})<noinclude>
 
== About ==
 
== About ==
 
This template serves to display health points in a page.
 
This template serves to display health points in a page.

Revision as of 17:13, 10 October 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 (♥)
  • {{Health|0}} → 0.5 (♥)
  • {{Health|1}} → 1 (♥)
  • {{Health|0}} → 1.5 (♥)
  • {{Health|2}} → 2 (♥)
  • {{Health|0}} → 2.5 (♥♥)
  • {{Health|3}} → 3 (♥♥)
  • {{Health|0}} → 3.5 (♥♥)
  • {{Health|4}} → 4 (♥♥)
  • {{Health|0}} → 4.5 (♥♥♥)
  • {{Health|5}} → 5 (♥♥♥)
  • {{Health|0}} → 5.5 (♥♥♥)
  • {{Health|6}} → 6 (♥♥♥)
  • {{Health|0}} → 6.5 (♥♥♥♥)
  • {{Health|7}} → 7 (♥♥♥♥)
  • {{Health|0}} → 7.5 (♥♥♥♥)
  • {{Health|8}} → 8 (♥♥♥♥)
  • {{Health|0}} → 8.5 (♥♥♥♥♥)
  • {{Health|9}} → 9 (♥♥♥♥♥)
  • {{Health|0}} → 9.5 (♥♥♥♥♥)
  • {{Health|10}} → 10 (♥♥♥♥♥)
  • {{Health|0}} → 10.5 (♥♥♥♥♥♥)
  • {{Health|11}} → 11 (♥♥♥♥♥♥)
  • {{Health|0}} → 11.5 (♥♥♥♥♥♥)
  • {{Health|12}} → 12 (♥♥♥♥♥♥)
  • {{Health|0}} → 12.5 (♥♥♥♥♥♥♥)
  • {{Health|13}} → 13 (♥♥♥♥♥♥♥)
  • {{Health|0}} → 13.5 (♥♥♥♥♥♥♥)
  • {{Health|14}} → 14 (♥♥♥♥♥♥♥)
  • {{Health|0}} → 14.5 (♥♥♥♥♥♥♥♥)
  • {{Health|15}} → 15 (♥♥♥♥♥♥♥♥)
  • {{Health|0}} → 15.5 (♥♥♥♥♥♥♥♥)
  • {{Health|16}} → 16 (♥♥♥♥♥♥♥♥)
  • {{Health|0}} → 16.5 (♥♥♥♥♥♥♥♥♥)
  • {{Health|17}} → 17 (♥♥♥♥♥♥♥♥♥)
  • {{Health|0}} → 17.5 (♥♥♥♥♥♥♥♥♥)
  • {{Health|18}} → 18 (♥♥♥♥♥♥♥♥♥)
  • {{Health|0}} → 18.5 (♥♥♥♥♥♥♥♥♥♥)
  • {{Health|19}} → 19 (♥♥♥♥♥♥♥♥♥♥)
  • {{Health|0}} → 19.5 (♥♥♥♥♥♥♥♥♥♥)
  • {{Health|20}} → 20 (♥♥♥♥♥♥♥♥♥♥)

Rounding examples:

  • {{Health|1.25}} → 1.25 (♥)
  • {{Health|1.5}} → 1.5 (♥)
  • {{Health|1.75}} → 1.75 (♥)

More than 20 health points:

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