Template:MaxPrice
Given a list of items, outputs the item with the highest price as well as the price in a few formats.
See also:
- Template:MinPrice for the same as this but minimum value
- Template:Max and Template:Min for just getting the largest or smallest number from a list
Usage
{{MaxPrice|item1|item2|item3|...|itemN}} {{MaxPrice|item1|item2|item3|...|itemN|coins=coins type|link=link type|format=format|var=variables}}
Unnamed parameters
All unnamed parameters are considered to be the item names. There is currently no limit on the number of items.
coins
By default the output value is unformatted. The coins param can be set to format the number:
coins=y
- format with Template:Coinscoins=n
- format with Template:NoCoinscoins=f
- format the formatnum magic word (add commas)
- Examples
* {{MaxPrice|Abyssal whip|Thread|Fire rune}} (default) * {{MaxPrice|coins=y|Abyssal whip|Thread|Fire rune}} * {{MaxPrice|coins=n|Abyssal whip|Thread|Fire rune}} * {{MaxPrice|coins=f|Abyssal whip|Thread|Fire rune}}
- Abyssal whip (1958166) (default)
- Abyssal whip (1,958,166)
- Abyssal whip (1,958,166)
- Abyssal whip (1,958,166)
link
By default the item name is linked. This can be changed by:
link=n
- remove the linklink=p
- format with Template:plinklink=plp
- format with Template:plinkp
- Examples
* {{MaxPrice|Abyssal whip|Thread|Fire rune}} (default) * {{MaxPrice|link=n|Abyssal whip|Thread|Fire rune}} * {{MaxPrice|link=p|Abyssal whip|Thread|Fire rune}} * {{MaxPrice|link=plp|Abyssal whip|Thread|Fire rune}}
- Abyssal whip (1958166) (default)
- Abyssal whip (1958166)
- Abyssal whip (1958166)
- (1958166)
var
Defining var will use that as the basis as names for two variables containing the price and name for later reuse. The variables will contain the formatting exactly as prescribed by the template (i.e. things will be linked or in coins, following the link and coins parameters). The variables are named X_item
and X_price
, where X
is the value of the var parameter supplied.
This can be done with any format option, though the format=none
option can be used to do entirely custom formatting.
{{MaxPrice|var=example|Abyssal whip|Thread|Fire rune}} {{MaxPrice|format=none|coins=y|link=p|var=example2|Nature rune|Huge bladed rune salvage|Staff of Sliske}} The best item is {{#var:example_item}} which costs {{#var:example_price}}. Another option is {{#var:example2_item}} which costs {{#var:example2_price}}.
Abyssal whip (1958166)
The best item is Abyssal whip which costs 1958166.
Another option is Nature rune which costs 208.
format
The format of the output can be changed with this parameter. Currently the following formats are supported:
- bracket
- Aliases: b, <nothing>
Bracket is the default format, it outputs the as "item (price)"
{{MaxPrice|format=b|Abyssal whip|Thread|Fire rune}}
Abyssal whip (1958166)
- bracketreverse
- Aliases: rb
Similar to bracket, but outputs with the item in the brackets: "price (item)"
{{MaxPrice|format=rb|Abyssal whip|Thread|Fire rune}}
1958166 (Abyssal whip)
- wikitable
- Aliases: table, t
Outputs using pipes, suitable for usage in a wikitable: "| item<newline>| price".
{| class="wikitable" ! example ! item ! price |- | best item {{MaxPrice|format=t|Abyssal whip|Thread|Fire rune}} |}
example | item | price |
---|---|---|
best item | Abyssal whip | 1958166 |
- wikitablereverse
- Aliases: table, t
Similar to wikitable, but the item and price are swapped: "| price<newline>| item".
{| class="wikitable" ! example ! price ! item |- | best item {{MaxPrice|format=t|Abyssal whip|Thread|Fire rune}} |}
example | price | item |
---|---|---|
best item | 1958166 | Abyssal whip |
- item
Outputs just the formatted item name (per the link param).
{{MaxPrice|format=item|Abyssal whip|Thread|Fire rune}}
- price
Outputs just the formatted price (per the coins param). You should consider using Template:Max, if you aren't using variable export.
{{MaxPrice|format=price|Abyssal whip|Thread|Fire rune}}
1958166
- none
Outputs nothing at all. This should only be used with variable export.
{{MaxPrice|format=none|Abyssal whip|Thread|Fire rune}}