Template:Img item/icon/doc: Difference between revisions

From PZwiki
(Created page with "<noinclude>{{Documentation subpage}}</noinclude>{{tlx|Img item/icon}} is a subtemplate of {{tlx|Img item}}. This functions as an '''icon''' index for all items. This templat...")
 
m (Automated Formatting)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<noinclude>{{Documentation subpage}}</noinclude>{{tlx|Img item/icon}} is a subtemplate of {{tlx|Img item}}. This functions as an '''icon''' index for all items.  
{{Documentation subpage}}{{tlx|Img item/icon}} is a subtemplate of {{tlx|Img item}}. This functions as an '''icon''' index for all items.


This template uses a [[wikipedia:Switch_statement|switch]], searching for a matching input [[wikipedia:String_(computer_science)|string]], returning an output string.  
This template uses a [[wikipedia:Switch_statement|switch]], searching for a matching input [[wikipedia:String_(computer_science)|string]], returning an output string.


==Usage==
==Usage==
Although a subtemplate, this can function as a standalone template to lookup an icon for an item.  
Although a subtemplate, this can function as a standalone template to lookup an icon for an item.


The input string should be the item's ''item ID'' (excluding the module) or the ''display name''.
The input string should be the item's ''item ID'' (excluding the module) or the ''display name''.
Line 14: Line 14:
#Click "Edit" (top-right)
#Click "Edit" (top-right)
#Copy the following snippet and paste in a new line, after the switch (top) and before the default (bottom): <code>| '''''ID'''''| '''''DisplayName''''' = '''''Output'''''</code>
#Copy the following snippet and paste in a new line, after the switch (top) and before the default (bottom): <code>| '''''ID'''''| '''''DisplayName''''' = '''''Output'''''</code>
#Replace: '''''<code>ID</code>''''' with the Item's ID (excluding the module), '''''<code>DisplayName</code>''''' with the Item's display name (as it appears in-game), and '''''<code>Output</code>''''' with the file you want to display (without the file extension e.g. PNG).  
#Replace: '''''<code>ID</code>''''' with the Item's ID (excluding the module), '''''<code>DisplayName</code>''''' with the Item's display name (as it appears in-game), and '''''<code>Output</code>''''' with the file you want to display (without the file extension e.g. PNG).
##Additional input strings can be added by placing a pipe <code>|</code> followed by the string after the last input string, but before the equals symbol <code>=</code>
##Additional input strings can be added by placing a pipe <code>|</code> followed by the string after the last input string, but before the equals symbol <code>=</code>
##*Example: <code>| LemonGrass| Lemongrass| Lemon Grass = Lemongrass</code>
##*Example: <code>| LemonGrass| Lemongrass| Lemon Grass = Lemongrass</code>
##Any additional input strings should be:  
##Any additional input strings should be:
##*Previous item names, e.g. Whiskey Bottle or Bourbon
##*Previous item names, e.g. Whiskey Bottle or Bourbon
##*Alternate item names, i.e. name in script file may be different to in-game item name (this is contained in ItemName_EN.txt), e.g. Lemon Grass or Lemongrass
##*Alternate item names, i.e. name in script file may be different to in-game item name (this is contained in ItemName_EN.txt), e.g. Lemon Grass or Lemongrass

Latest revision as of 14:07, 14 April 2024

Notebook.png
This is a documentation subpage for Template:Img item/icon.
It contains usage information and other content that is not part of the original template page.

{{Img item/icon}} is a subtemplate of {{Img item}}. This functions as an icon index for all items.

This template uses a switch, searching for a matching input string, returning an output string.

Usage

Although a subtemplate, this can function as a standalone template to lookup an icon for an item.

The input string should be the item's item ID (excluding the module) or the display name.

{{Img item/icon|item=Item ID <!-- or DisplayName -->}}

Adding to index

The index can be added to by:

  1. Click "Edit" (top-right)
  2. Copy the following snippet and paste in a new line, after the switch (top) and before the default (bottom): | ID| DisplayName = Output
  3. Replace: ID with the Item's ID (excluding the module), DisplayName with the Item's display name (as it appears in-game), and Output with the file you want to display (without the file extension e.g. PNG).
    1. Additional input strings can be added by placing a pipe | followed by the string after the last input string, but before the equals symbol =
      • Example: | LemonGrass| Lemongrass| Lemon Grass = Lemongrass
    2. Any additional input strings should be:
      • Previous item names, e.g. Whiskey Bottle or Bourbon
      • Alternate item names, i.e. name in script file may be different to in-game item name (this is contained in ItemName_EN.txt), e.g. Lemon Grass or Lemongrass
      • UK vs US spelling, e.g. Tire or Tyre
  4. Also add to {{Img item/name}} and {{Img_item/link}}

Example

Type Produces Explanation
{{Img item/icon|item=ShotgunShellsBox}}
ShotgunAmmoBox Using the item ID
{{Img item/icon|item=Box of Shotgun Shells}}
ShotgunAmmoBox Using the display name