Advertisement

Item

This template uses Module:Item, a script written in the Lua programming language. Please see wikipedia:Lua and mw:Extension:Scribunto to learn more about Lua.
Template-info.png Documentation The documentation below is transcluded from Template:Item/doc. (edit | history)

An all-in-one template for display item name/icon/link.

By default, displays a link to the item and adds an item icon in front of it.

Usage

All parameters are optional. Despite this, some combinations are invalid and may cause errors, e.g. {{item|icons=no|mode=image}}

See examples below for more details.

unnamed parameter 1

Default item display name, link target, and image file name.

unnamed Parameter 2 or t

Custom link text, which can include line breaks (<br />) and other wikitext. If an 's', 'es', 'ies' or 'ves' is passed as the custom text, it will be appended to the end of the item name. Pluralism is partially intuitive - adding 's' to Butterfly will return Butterflies.

mode

Display mode. It can be:

  • image(Preferred) or imageonly or onlyimage means only image will be displayed;
  • text(Preferred) or noimage means no image will be displayed;
  • table(Preferred) or 2-cell will output 2 cells code for table. This is roughly a shortcut for {{item|mode=image|itemname}} || {{item|mode=text|itemname}}

Use preferred values as much as possible to get the best performance.

image

image filename, no brackets nor "File:"(must include file extension, eg. Parrot.png).

You can specify multiple images, just seperate filenames with slashes(eg. Parrot.png/Parrot (placed).png).

size

Custom graphic size (Read Extended image syntax for details).

You can specify multiple sizes, just seperated with slashes(eg. 32px/24x24px).

When multiple images specified:

    • If only one size specified, it will apply to all images
    • if size is less then image, extra images will be displayed as if they don't have size argument
    • if size is more then image, extra sizes will simply be ignored.

And you can append it with *[factor] to scale image, e.g. 24x24px*0.5, 24px*0.5/24px*2 ...

scale

Image(s) will be scaled based on size and scale. e.g. |size=32x32px|scale=0.5 is equal to |size=16x16px. This will multiply with scale factor in size paramter, |size=32x32px*0.5|scale=0.5 is equal to |size=8x8px. scale can be set by options.

ext

image file extension, default is png. Only valid when there is no image input.

link

Custom link target. If blank given(i.e. |link=|), it will be no link(See example below).

nolink = y/yes

Same as |link=|, only valid when there is no link input. If you use |link=somelink|nolink=y, it will be ignored.

anchor = y/yes

If set, will create an anchor for {{{1}}}.

note

Extra note text. By default, it will displayed as smaller and gray text between item name and platform icons , and without link on it.

note2

Another note text. By default, it will displayed as gray txt in normal size, without link, and always take a single line.

wrap = y/yes

Only valid when there is no id= or note2= input. If set, platform icons and/or note will be displayed in new line.

class

Custom Css class(es). There're some predefined classes for certain formatting purpose(see examples below). You can add yours if needed.

css or style

Custom css style rules.

Examples

Basic

Result Code Note
Bed.png Bed {{item|Bed}} Basic usage.
Bed.png Any Bed {{item|Bed|Any Bed}} Custom text.
Psycho Knife.png Psycho Knives Butterfly.png Butterflies {{item|Psycho Knife|s}} {{item|Butterfly|s}} plural.
Wall of Flesh.png Wall of Flesh {{item|Wall of Flesh|size=32px}} custom image size. (Read Extended image syntax for details).
Wall of Flesh.png Wall of
Flesh
{{item|Wall of Flesh|size=32px|Wall of<br/>Flesh}} Custom text in multiple lines.
Treasure Bag.gif Treasure Bags {{item|Treasure Bag|s|ext=gif}} Custom image file extension.
Treasure Bag.gif Treasure Bags(Expert Mode) {{item|Treasure Bag|s|note={{small|(Expert Mode)}}|ext=gif}} Note text.
Parrot.png Parrot Pet {{item|Pet Parrot|image=Parrot.png|Parrot Pet}} Custom image file name.
Parrot.png Parrot Pet {{item|Pet Parrot|image=Parrot.png|Parrot Pet|ext=jpg}} Will display Parrot.png, ext is ignored when image specified.
Parrot.png Parrot Pet {{item|Parrot|link=Pet Parrot|Parrot Pet}} Custom link target.
Beeswax.png Beeswax {{item|Beeswax|link=}} Unlinked.
Beeswax.png Beeswax {{item|Beeswax|nolink=y}} Unlinked.
Beeswax.png Beeswax {{item|Beeswax|nolink=y|link=Bee}} if link is specified, it will override unlink=y.

Size and scale

Result Code Note
Beeswax.png Beeswax {{item|Beeswax}} Default size, this image is 32px in height.
Beeswax.png Beeswax {{item|Beeswax|size=16px}} Custom absolute size.
Beeswax.png Beeswax {{item|Beeswax|size=*0.5}} Custom scaled size.
Beeswax.png Beeswax {{item|Beeswax|size=x40px*0.5}} scaled absoulte size.
Beeswax.png Beeswax {{item|Beeswax|scale=0.5}} scale
Beeswax.png Beeswax {{item|Beeswax|size=40px*0.5|scale=2}} combine scaled size and scale.
Beeswax.png Beeswax {{item/options|scale=0.5}}{{item|Beeswax}}{{item/options|reset}} change scale via option.

Note: Due to the way of [[File:]]'s size option works, if you want to set a size(after scale) larger then origin image size, you need to set it in DDpx or DDxDDpx, and xDDpx will be no effect. e.g. for Beeswax, {{item|Beeswax|size=x40px}} will be no effect.

Multiple images

Result Code Note
Furnace.png Furnace (placed).gif Furnace {{item|Furnace|image=Furnace.png/Furnace_(placed).gif}} Multiple images with auto size.
Furnace.png Furnace (placed).gif Furnace {{item|Furnace|image=Furnace.png/Furnace_(placed).gif|size=20px}} Only one size specified, all images will use this size.
Furnace.png Furnace (placed).gif Furnace {{item|Furnace|image=Furnace.png/Furnace_(placed).gif|size=30px/20px}} Multiple images with multiple sizes.
Furnace.png Furnace (placed).gif Furnace {{item|Furnace|image=Furnace.png/Furnace_(placed).gif|size=30px/20px/300px}} Size is more them images, extra size is ignored.
Furnace.png Furnace (placed).gif Hellforge.png Furnace {{item|Furnace|image=Furnace.png/Furnace_(placed).gif/Hellforge.png|size=16px/50px}} Size is less then image, extra image will use auto size.

Wrap and note2

wrap is valid only when note2 is not specified.

Result Code Note
Beeswax.png Beeswax {{item|Beeswax|wrap=y}}
Bed.png bed(some note) {{item|bed|wrap=y|note=(some note)}} If there are some note, note will wrap next line.
Beeswax.png Beeswax(some note) {{item|Beeswax|wrap=y|note=(some note)}} If there are some note, note will display in next line.
Beeswax.png Beeswax
some other notes.
{{item|Beeswax|wrap=y|note2=some other notes.}} note2 is similar.

Display mode

Result Code Note
Beeswax(some note) {{item|Beeswax|mode=text|wrap=y|note=(some note)}} mode=text: image won't be displayed.
Beeswax.png Beeswax
Butterfly.png Butterflies(some note)
{| class="wikitable"
|{{item|Beeswax|mode=table}}
|-
|{{item|Butterfly|ies|note=(some note)|mode=table}}
|}
mode=table: output as two adjacent cells for table.

Change default options

You can use {{item/options}} to set/get and reset some options' default value.

Usage

  • Set: {{item/options|nolink=y|smallicons=no|...}} or {{item/options|set|nolink=y|smallicons=no|...}}
  • get: {{item/options|get|nolink}}
  • reset: {{item/options|reset}} or {{item/options|resetall}}
NOTE: In order to avoid unwanted influences, it is very important to reset options as soon as possible. Especially in the template, you should reset options before the template ends.

All parameters:

unnamed parameter 1

Action. get or load means get the current value of a option, reset or resetall means reset all options to default value, other values(include none. if you want, recommend to use set for better readability) means set options' value.

unnamed Parameter 2

The name of option which you want to get its value, only valid when action is get. Can be small, smallicons, icons, mode, wrap, nolink, class, css or style.

mode

Only valid when action is set. Set the default value for {{item}}'s mode parameter. You can use any valid value for {{item}}'s mode parameter, and a invalid value(recommend to use default, all, or both for better readability) means change the mode back to default. See {{item}}'s mode parameter.

wrap = y/yes/n/no

Only valid when action is set. Turn on/off line wrap. See {{item}}'s wrap parameter.

anchor = y/yes/n/no

Only valid when action is set. Turn on/off anchor. See {{item}}'s anchor parameter.

nolink = y/yes/n/no

Only valid when action is set. Turn on/off no link option. See {{item}}'s nolink parameter.

class

Only valid when action is set. Default value for class. See {{item}}'s class parameter.

css/style

Only valid when action is set. Default value for css. See {{item}}'s css parameter.

See examples below for more details.

Example

Code output
By default: 

{{item|Beeswax|note=(note)}}

turn on line wrap, and set to text mode: 
{{item/options|set|wrap=y|mode=text}}
{{item|Beeswax|note=(note)}}

turn on no link mode: 
{{item/options|set|nolink=y}}
{{item|Beeswax|note=(note)}}

This will be overrided by '''<code>link=</code>'''

{{item|Beeswax|note=(note)|link=Bee}}

get current setting:

nolink = {{item/options|get|nolink}} ; 
wrap = {{item/options|get|wrap}} ;
mode = {{item/options|get|mode}} ;

reset all options: 
{{item/options|reset}}
{{item|Beeswax|note=(note)}}

custom css and class:
{{item/options|set|css=border:1px solid red;padding:3px}}
{{item|Beeswax|note=(note)}}
{{item/options|set|class=boldname}}
{{item|Beeswax|note=(note)}}

reset all:
{{item/options|resetall}}
{{item|Beeswax|note=(note)}}

By default:

Beeswax.png Beeswax(note)

turn off platform icons:

Beeswax.png Beeswax(note)

turn on platform icons, and turn on small icons:

Beeswax.png Beeswax(note)

turn on line wrap, and set to text mode:

Beeswax(note)

turn on no link mode:

Beeswax(note)

This will be overrided by link=

Beeswax(note)

get current setting:

nolink = y ; wrap = y ; mode = text ;

reset all options:

Beeswax.png Beeswax(note)

custom css and class:

Beeswax.png Beeswax(note)

Beeswax.png Beeswax(note)

reset all:

Beeswax.png Beeswax(note)


Community content is available under CC BY-SA 3.0 unless otherwise noted.