Difference between revisions of "Template:Friendly"
Jump to navigation
Jump to search
(add code comments, add Page variable) |
(category param for disabling category in docs) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
|style="text-align:center;"|<!-- | |style="text-align:center;"|<!-- | ||
IMAGE | IMAGE | ||
-->[[File:{{#if:{{{{#var:Page}}|Image}}|{{{{#var:Page}}|Image}}|{{#var:Page}}.png}}|link={{#var:Page}}/Tooltip|alt={{#var:Page}}|{{#var:Page}}]]<!-- | -->[[File:{{#if:{{:{{#var:Page}}|Image}}|{{:{{#var:Page}}|Image}}|{{#var:Page}}.png}}|link={{#var:Page}}/Tooltip|alt={{#var:Page}}|{{#var:Page}}]]<!-- | ||
IMAGE END | IMAGE END | ||
NPC DATA | NPC DATA | ||
--> | --> | ||
|colspan="2" style="text-align:center;"|<!-- | |colspan="2" style="text-align:center;"|<!-- | ||
-->'''{{C|Brown|Name:}}''' {{#if:{{{{#var:Page}}|Name}}|{{{{#var:Page}}|Name}}|{{#var:Page}}}}<br><br><!-- | -->'''{{C|Brown|Name:}}''' {{#if:{{:{{#var:Page}}|Name}}|{{{{#var:Page}}|Name}}|{{#var:Page}}}}<br><br><!-- | ||
-->'''{{C|Brown|Occupation:}}''' {{{{#var:Page}}|Occupation}}<br><!-- | -->'''{{C|Brown|Occupation:}}''' {{:{{#var:Page}}|Occupation}}<br><!-- | ||
-->'''{{C|Brown|Residence:}}''' {{{{#var:Page}}|Residence}}<!-- | -->'''{{C|Brown|Residence:}}''' {{:{{#var:Page}}|Residence}}<!-- | ||
-->{{#if:{{{{#var:Page}}|Sells}}|<br>'''{{C|Brown|Sells:}}''' {{{{#var:Page}}|Sells}}}}<!-- | -->{{#if:{{:{{#var:Page}}|Sells}}|<br>'''{{C|Brown|Sells:}}''' {{:{{#var:Page}}|Sells}}}}<!-- | ||
NPC DATA END | NPC DATA END | ||
--> | --> | ||
|}<!-- | |}<!-- | ||
TABLE END | TABLE END | ||
CATEGORY FOR SUBPAGES -->{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{#var:Page}}/Tooltip |[[Category:NPC tooltips]]|{{#if: {{#titleparts: {{PAGENAME}} | 1 | 3}}|[[Category:{{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} NPC tooltips]]|[[Category:{{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} NPCs]]}}}}|[[Category: NPCs]]}}<!-- | CATEGORY FOR SUBPAGES -->{{#if: {{{category|}}} ||{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{#var:Page}}/Tooltip |[[Category:NPC tooltips]]|{{#if: {{#titleparts: {{PAGENAME}} | 1 | 3}}|[[Category:{{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} NPC tooltips]]|[[Category:{{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} NPCs]]}}}}|[[Category: NPCs]]}}}}<!-- | ||
CATEGORY FOR SUBPAGES END --></includeonly><noinclude>{{doc}} | CATEGORY FOR SUBPAGES END --></includeonly><noinclude>{{doc}} | ||
[[Category:Tooltip templates]]</noinclude> | [[Category:Tooltip templates]]</noinclude> | ||
Latest revision as of 15:29, 9 October 2025
This is template created for use together with the Template:Tooltip hover box template on a specific Friendly NPC's page or Friendly NPC's tooltip page.
Usage: The page itself must contain the Friendly NPC's data before this Template works. For example, if I wanted to create the Frid page, I'll add this code to the start of the page:
<includeonly>{{#switch: {{{1}}}
|Name = (optional)
|Occupation = Herbalist
|Residence = Osbrook
|Sells = Herbs, Medicine, Scrolls
|#default =
}}</includeonly>
This data is invisible on the page itself, thanks to the includeonly tags.
Next, copy this code to Frid or Frid/anything page:
{{ {{{1|Tooltip hover box}}}
|title= {{Friendly}}
}}
Adding a parameter specifies which NPC to show (default is current page name):
{{ {{{1|Tooltip hover box}}}
|title= {{Friendly|Frid}}
}}
Result:
