Difference between revisions of "Template:Hunger"

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!

(Created page with "{{#ifexpr: {{{1}}} > 0 | 12x12px|class=item-icon pixel|link=Hunger}}{{#ifexpr: {{{1}}} > 1.49 | File:ui-hunger.png|12x12px|class=item-icon pixel|link=...")
 
(Display the empty hunger icon if value is equal or lower than 0, and added possibilty to change normal hunger icons for the poisoned one if using the parameter "poisoned")
Line 1: Line 1:
{{#ifexpr: {{{1}}} > 0 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 1.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 2.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 3.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 4.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 5.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 6.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 7.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 8.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 9.49 | [[File:ui-hunger.png|12x12px|class=item-icon pixel|link=Hunger]]}}<noinclude>
+
{{#ifexpr: {{{1}}} > 0 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]] | {{#ifexpr: {{{1}}} = 0 or {{{1}}} < 0 | [[File:ui-hunger-empty.png|12x12px|class=item-icon pixel|link=Hunger]]}}}}{{#ifexpr: {{{1}}} > 1.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 2.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 3.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 4.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 5.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 6.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}{{#ifexpr: {{{1}}} > 7.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}{{#ifexpr: {{{1}}} > 8.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}
 +
{{#ifexpr: {{{1}}} > 9.49 | [[File:ui-hunger{{#if: {{{poisoned}}}|-poisoned}}.png|12x12px|class=item-icon pixel|link=Hunger]]}}<noinclude>
 
== About ==
 
== About ==
 
This template serves to display hunger points in a page.
 
This template serves to display hunger points in a page.
  
 
== Usage ==
 
== Usage ==
The syntax of this template is <code><nowiki>{{Hunger|<number>}}</nowiki></code>. If the value given is <code>0</code> or lower, it will display nothing, and if the value is higher than <code>10</code>, it will display 10 hunger icons. It can also round to the nearest integer.
+
The syntax of this template is <code><nowiki>{{Hunger|<number>|<poisoned>?}}</nowiki></code>. If the value given is <code>0</code> or lower, it will display nothing, and if the value is higher than <code>10</code>, it will display 10 hunger icons. It can also round to the nearest integer. When using the <code>poisoned</code> parameter (no value required), all hunger icons will change to it's poisoned version.
  
 
== Examples ==
 
== Examples ==
Line 23: Line 24:
 
* <code><nowiki>{{Hunger|1.5}}</nowiki></code> → {{Hunger|1.5}}
 
* <code><nowiki>{{Hunger|1.5}}</nowiki></code> → {{Hunger|1.5}}
 
* <code><nowiki>{{Hunger|1.75}}</nowiki></code> → {{Hunger|1.75}}
 
* <code><nowiki>{{Hunger|1.75}}</nowiki></code> → {{Hunger|1.75}}
 +
 +
Poisoned examples:
 +
* <code><nowiki>{{Hunger|5|Poisoned}}</nowiki></code> → {{Hunger|5|Poisoned}}
 +
* <code><nowiki>{{Hunger|6.5|Poisoned}}</nowiki></code> → {{Hunger|6.5|Poisoned}}
 +
* <code><nowiki>{{Hunger|3|Poisoned}}</nowiki></code> → {{Hunger|3|Poisoned}}
 
</noinclude>
 
</noinclude>

Revision as of 11:41, 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 "{".{{#ifexpr: {{{1}}} > 7.49 | Ui-hunger-poisoned.png}Expression error: Unrecognized punctuation character "{". Expression error: Unrecognized punctuation character "{".

About

This template serves to display hunger points in a page.

Usage

The syntax of this template is {{Hunger|<number>|<poisoned>?}}. If the value given is 0 or lower, it will display nothing, and if the value is higher than 10, it will display 10 hunger icons. It can also round to the nearest integer. When using the poisoned parameter (no value required), all hunger icons will change to it's poisoned version.

Examples

  • {{Hunger|0}}Ui-hunger-empty.png{{#ifexpr: 0 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|1}}Ui-hunger-poisoned.png{{#ifexpr: 1 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|2}}Ui-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 2 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|3}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 3 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|4}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 4 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|5}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 5 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|6}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 6 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|7}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 7 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|8}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 8 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|9}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 9 > 7.49 | Ui-hunger-poisoned.png}Ui-hunger-poisoned.png
  • {{Hunger|10}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 10 > 7.49 | Ui-hunger-poisoned.png}Ui-hunger-poisoned.png

Ui-hunger-poisoned.png

Rounding examples:

  • {{Hunger|1.25}}Ui-hunger-poisoned.png{{#ifexpr: 1.25 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|1.5}}Ui-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 1.5 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|1.75}}Ui-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 1.75 > 7.49 | Ui-hunger-poisoned.png}


Poisoned examples:

  • {{Hunger|5|Poisoned}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 5 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|6.5|Poisoned}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 6.5 > 7.49 | Ui-hunger-poisoned.png}
  • {{Hunger|3|Poisoned}}Ui-hunger-poisoned.pngUi-hunger-poisoned.pngUi-hunger-poisoned.png{{#ifexpr: 3 > 7.49 | Ui-hunger-poisoned.png}