Difference between revisions of "Template:Infobox Character/requires"
J McKalling (Talk | contribs) m |
J McKalling (Talk | contribs) |
||
Line 1: | Line 1: | ||
<includeonly>{{ | <includeonly>{{ | ||
#if: {{{1|}}} | #if: {{{1|}}} | ||
− | + | | {{#iferror: {{#ifexpr: {{#if:{{{amount|}}}|{{{amount}}}}}>0 | ({{#expr:{{{amount}}}}}x) | none of: }} | none of: }} [[{{{1}}}]] {{ | |
− | + | #ifeq: {{{nocat|false}}} | false | {{ | |
− | + | #ifexists: {{{1}}} || [[Category:Characters with a missing requirement]] }}}} | |
− | + | ||
− | + | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
− | This template displays an [[:Category:Inventory Items|Inventory Items]] requirement with an amount. It is used to specify what a character requires to | + | This template displays an [[:Category:Inventory Items|Inventory Items]] requirement with an amount. It is used to specify what a character requires to talk to them or to use their service(s). This also automatically categorizes the article under [[:Category:Characters with a missing requirement]] when the specified article doesn't exist yet. |
==Parameters== | ==Parameters== | ||
# The pagename of an article from [[:Category:Inventory Items]] or a subcategory (no parameter name but value is case sensitive, defaults to nothing displayed) | # The pagename of an article from [[:Category:Inventory Items]] or a subcategory (no parameter name but value is case sensitive, defaults to nothing displayed) | ||
− | * '''amount''': A number representing the amount of said requirement (positive numeric, defaults to string "none of:") | + | * '''amount''': A number (expression) representing the amount of said requirement (positive numeric, defaults to string "none of:") |
− | * '''nocat''': Whether or not to suppress categorization in case | + | * '''nocat''': Whether or not to suppress categorization in case the specified article doesn't exist (defaults to false, which means auto categorization). |
− | '''''Note''': Eventhough the numbered (pagename) parameter is optional, it is required for anything to be displayed at all | + | '''''Note''': Eventhough the numbered (pagename) parameter is optional, it is required for anything to be displayed at all.'' |
==Syntax== | ==Syntax== | ||
Line 21: | Line 19: | ||
==Examples== | ==Examples== | ||
− | Common use includes both the filename and '''amount''' parameters, with the latter accepting a mathematical expression: | + | Common use includes both the filename and '''amount''' parameters, with the latter accepting a mathematical expression as well, so these all have the same result: |
<nowiki>{{infobox character/requires|Kashes|amount=10}}</nowiki> | <nowiki>{{infobox character/requires|Kashes|amount=10}}</nowiki> | ||
− | <nowiki>{{infobox character/requires|Kashes|amount=2 + | + | <nowiki>{{infobox character/requires|Kashes|amount=00010}}</nowiki> |
− | <nowiki>{{infobox character/requires|Kashes|amount=3 * 4}}</nowiki> | + | <nowiki>{{infobox character/requires|Kashes|amount=2 + 8}}</nowiki> |
+ | <nowiki>{{infobox character/requires|Kashes|amount=3 * 4 - 2}}</nowiki> | ||
+ | <nowiki>{{infobox character/requires|Kashes|amount=2 * 5}}</nowiki> | ||
+ | <nowiki>{{infobox character/requires|Kashes|amount=40 / 4}}</nowiki> | ||
+ | <nowiki>{{infobox character/requires|Kashes|amount=43 % 11}}</nowiki> | ||
:(10x) [[Kashes]] | :(10x) [[Kashes]] | ||
− | |||
− | |||
Line 40: | Line 40: | ||
− | + | In some cases, it may be desired to specify an alternate text for the link, which you can by using the <nowiki>{{</nowiki>[[Template:!|!]]<nowiki>}}</nowiki> template like this: | |
+ | <nowiki>{{infobox character/requires|Zlitos{{!}}Money money money!|amount=500}}</nowiki> | ||
+ | |||
+ | :(500x) [[Zlitos|Money money money!]] | ||
+ | |||
+ | |||
+ | You may leave ''amount'' undefined (which would not raise any maintenance task, [[Template talk:{{PAGENAME}}|discuss]]) by not specifying any valid number expression, so these all have the same result (defaulting to "none of:"): | ||
<nowiki>{{infobox character/requires|Kashes}}</nowiki> | <nowiki>{{infobox character/requires|Kashes}}</nowiki> | ||
<nowiki>{{infobox character/requires|Kashes|}}</nowiki> | <nowiki>{{infobox character/requires|Kashes|}}</nowiki> | ||
Line 66: | Line 72: | ||
− | When a nonexisting articlename is specified (which would raise the [[:Category:Characters with a missing requirement|Characters with a missing requirement]] maintenanance task), | + | When a nonexisting articlename is specified (which would raise the [[:Category:Characters with a missing requirement|Characters with a missing requirement]] maintenanance task), the link will just become red as usual: |
<nowiki>{{infobox character/requires|Nonexisting Item|amount=10}}</nowiki> | <nowiki>{{infobox character/requires|Nonexisting Item|amount=10}}</nowiki> | ||
− | :( | + | :(10x) [[Nonexisting Item]] |
Revision as of 22:31, 26 November 2012
This template displays an Inventory Items requirement with an amount. It is used to specify what a character requires to talk to them or to use their service(s). This also automatically categorizes the article under Category:Characters with a missing requirement when the specified article doesn't exist yet.
Parameters
- The pagename of an article from Category:Inventory Items or a subcategory (no parameter name but value is case sensitive, defaults to nothing displayed)
- amount: A number (expression) representing the amount of said requirement (positive numeric, defaults to string "none of:")
- nocat: Whether or not to suppress categorization in case the specified article doesn't exist (defaults to false, which means auto categorization).
Note: Eventhough the numbered (pagename) parameter is optional, it is required for anything to be displayed at all.
Syntax
{{infobox character/requires|articlename|amount=number}}
Examples
Common use includes both the filename and amount parameters, with the latter accepting a mathematical expression as well, so these all have the same result:
{{infobox character/requires|Kashes|amount=10}} {{infobox character/requires|Kashes|amount=00010}} {{infobox character/requires|Kashes|amount=2 + 8}} {{infobox character/requires|Kashes|amount=3 * 4 - 2}} {{infobox character/requires|Kashes|amount=2 * 5}} {{infobox character/requires|Kashes|amount=40 / 4}} {{infobox character/requires|Kashes|amount=43 % 11}}
- (10x) Kashes
The order in which the parameters are specified is not important, so these all have the same result:
{{infobox character/requires|Zlitos|amount=30}} {{infobox character/requires|1=Zlitos|amount=30}} {{infobox character/requires|amount=30|Zlitos}} {{infobox character/requires|amount=30|1=Zlitos}}
- (30x) Zlitos
In some cases, it may be desired to specify an alternate text for the link, which you can by using the {{!}} template like this:
{{infobox character/requires|Zlitos{{!}}Money money money!|amount=500}}
- (500x) Money money money!
You may leave amount undefined (which would not raise any maintenance task, discuss) by not specifying any valid number expression, so these all have the same result (defaulting to "none of:"):
{{infobox character/requires|Kashes}} {{infobox character/requires|Kashes|}} {{infobox character/requires|Kashes|amount=}} {{infobox character/requires|Kashes|amount=three}} {{infobox character/requires|Kashes|amount=many}} {{infobox character/requires|Kashes|amount=3 + one}} {{infobox character/requires|Kashes|amount=3 +}} {{infobox character/requires|Kashes|amount=@}} {{infobox character/requires|Kashes|amount=none of:}} {{infobox character/requires|Kashes|amount=noooone of:}}
- none of: Kashes
You may leave "requires" undefined (which would not raise any maintenance task) by not specifying any articlename, so these all have the same result (nothing displayed):
{{infobox character/requires}} {{infobox character/requires|}} {{infobox character/requires|1=}} {{infobox character/requires|amount=3}} {{infobox character/requires||amount=3}} {{infobox character/requires|1=|amount=3}} {{infobox character/requires|5=Possibly existing article name|amount=3}} {{infobox character/requires| |amount=3}}
When a nonexisting articlename is specified (which would raise the Characters with a missing requirement maintenanance task), the link will just become red as usual:
{{infobox character/requires|Nonexisting Item|amount=10}}
- (10x) Nonexisting Item
The nocat parameter may be used to suppress automatic categorization like this (any value will do):
{{infobox character/requires|Nonexisting Item|amount=10|nocat=true}}
This would render the same result as the last example above, but would not categorize under Category:Characters with a missing requirement. This feature works on any nonempty nonexisting articlename.