Difference between revisions of "Template:Infobox Character/requires"

From Twinsuniverse
Jump to: navigation, search
m
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<includeonly>{{
 
<includeonly>{{
 
#if: {{{1|}}}
 
#if: {{{1|}}}
| {{
+
| {{#iferror: {{#ifexpr: {{#if:{{{amount|}}}|{{{amount}}}}}>0 | ({{#expr:{{{amount}}}}}x) | none of: }} | none of: }} [[{{{1}}}]] {{
  #ifexist: File:{{{1}}}
+
    #ifeq: {{{nocat|false}}} | false | {{
  |{{#ifeq: {{#iferror: {{#ifexpr: {{#if:{{{amount|}}}|{{{amount}}}}}>0 | ({{{amount}}}x) }}}} || none of: }}
+
        #ifexist: {{{1}}} || {{maintenance task|nocat={{{nocat|false}}}
      [[{{{1}}}]]
+
            |category=Characters with a missing requirement
  |(...) [[{{{1}}}|missing requirement]]{{
+
            |doclink=Infobox Character/requires
      #ifeq: {{{nocat|false}}} | false | [[Category:Characters with a missing requirement]]}}}}
+
            |display=false
}}</includeonly><noinclude>
+
            |reason=The '''requires''' parameter refers to a [[{{{1}}}|nonexisting article]] (click to create)}} }}}}
This template displays an [[:Category:Inventory Items|Inventory Items]] requirement with an amount. It is used to specify what a character requires to be able to be talked to or 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.
+
}}</includeonly><noinclude>{{Infobox Template
 +
|purpose=infobox
 +
|singletag=no
 +
|multiline=no
 +
|gamerelated=yes
 +
|suppressible=recursively
 +
|choice=none
 +
|cat1=Characters with a missing requirement!''when article missing''!maintenance
 +
|var1=
 +
}}
 +
 
 +
This template displays an [[:Category:Items|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: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 of an invalid requirement articlename (defaults to false, which means auto categorization).
+
* '''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, in which case it has to be an existing article.''
+
'''''Note''': Eventhough the numbered (pagename) parameter is optional, it is required for anything to be displayed at all.''
  
 
==Syntax==
 
==Syntax==
  <nowiki>{{infobox character/requires|articlename|amount=number}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|articlename|amount=number}}</nowiki>
  
 
==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 + 6}}</nowiki>
+
  <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]]
:(8x) [[Kashes]]
 
:(12x) [[Kashes]]
 
  
  
 
The order in which the parameters are specified is not important, so these all have the same result:
 
The order in which the parameters are specified is not important, so these all have the same result:
  <nowiki>{{infobox character/requires|Zlitos|amount=30}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Zlitos|amount=30}}</nowiki>
  <nowiki>{{infobox character/requires|1=Zlitos|amount=30}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|1=Zlitos|amount=30}}</nowiki>
  <nowiki>{{infobox character/requires|amount=30|Zlitos}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|amount=30|Zlitos}}</nowiki>
  <nowiki>{{infobox character/requires|amount=30|1=Zlitos}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|amount=30|1=Zlitos}}</nowiki>
  
 
:(30x) [[Zlitos]]
 
:(30x) [[Zlitos]]
  
  
When an invalid number is specified for the '''amount''' (which would not raise any maintenanance task, [[Template talk:{{PAGENAME}}|discuss]]), it defaults to "none of:", so these all have the same result:
+
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|Kashes}}</nowiki>
+
<nowiki>{{Infobox Character/requires|Zlitos{{!}}Money money money!|amount=500}}</nowiki>
  <nowiki>{{infobox character/requires|Kashes|}}</nowiki>
+
 
  <nowiki>{{infobox character/requires|Kashes|amount=}}</nowiki>
+
:(500x) [[Zlitos|Money money money!]]
  <nowiki>{{infobox character/requires|Kashes|amount=three}}</nowiki>
+
 
  <nowiki>{{infobox character/requires|Kashes|amount=many}}</nowiki>
+
 
  <nowiki>{{infobox character/requires|Kashes|amount=3 + one}}</nowiki>
+
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|amount=3 +}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Kashes}}</nowiki>
  <nowiki>{{infobox character/requires|Kashes|amount=@}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Kashes|}}</nowiki>
  <nowiki>{{infobox character/requires|Kashes|amount=none of:}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Kashes|amount=}}</nowiki>
  <nowiki>{{infobox character/requires|Kashes|amount=noooone of:}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Kashes|amount=three}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=many}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=3 + one}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=3 +}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=@}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=none of:}}</nowiki>
 +
  <nowiki>{{Infobox Character/requires|Kashes|amount=noooone of:}}</nowiki>
  
 
:none of: [[Kashes]]
 
:none of: [[Kashes]]
Line 57: Line 76:
  
 
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):
 
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):
  <nowiki>{{infobox character/requires}}</nowiki>
+
  <nowiki>{{Infobox Character/requires}}</nowiki>
  <nowiki>{{infobox character/requires|}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|}}</nowiki>
  <nowiki>{{infobox character/requires|1=}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|1=}}</nowiki>
  <nowiki>{{infobox character/requires|amount=3}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|amount=3}}</nowiki>
  <nowiki>{{infobox character/requires||amount=3}}</nowiki>
+
  <nowiki>{{Infobox Character/requires||amount=3}}</nowiki>
  <nowiki>{{infobox character/requires|1=|amount=3}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|1=|amount=3}}</nowiki>
  <nowiki>{{infobox character/requires|5=Possibly existing article name|amount=3}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|5=Possibly existing article name|amount=3}}</nowiki>
  <nowiki>{{infobox character/requires|      |amount=3}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|      |amount=3}}</nowiki>
  
  
When a nonexisting articlename is specified (which would raise the [[:Category:Characters with a missing requirement|Characters with a missing requirement]] maintenanance task), a red-link is displayed for it and the amount hidden like this:
+
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>
  
:(...) [[Nonexisting Item|missing requirement]]
+
:(10x) [[Nonexisting Item]]
  
  
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
  <nowiki>{{infobox character/requires|Nonexisting Item|amount=10|nocat=true}}</nowiki>
+
  <nowiki>{{Infobox Character/requires|Nonexisting Item|amount=10|nocat=true}}</nowiki>
  
 
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.
 
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.
  
[[Category:Article Categorizers|character]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 22:33, 10 June 2014

Infobox Character/requires
Purpose

Infobox [list all]

Single tag

No [list all]

Multi-line

No [list all]

Protected

No [list all]

Game related

Yes [list all]

Categorization
Suppressible

Recursively [list all]

Choice

No choice [list all]

Categories

One: [list all]

Variables
Names

none [list all]

Subpages

This template displays an 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

  1. The pagename of an article from Category: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.