Difference between revisions of "User:Wookipan/Map overview"

From Team Fortress Wiki
Jump to: navigation, search
m (Remove title and image parameters)
(Add exception for file image to allow full file name usage, revamp and expand doc)
Line 10: Line 10:
 
-->{{common string|map locations notice}}
 
-->{{common string|map locations notice}}
 
</div></div><!--
 
</div></div><!--
-->[[File:{{#if:{{{image|}}}|{{{image}}}|{{#if:{{SUBPAGENAME}} overview|{{#ifexist:{{SUBPAGENAME}}|{{SUBPAGENAME}}|Pier}}|}}}} overview.png|800px|link=]]
+
-->[[File:{{#if:{{{image|}}}|{{{image}}}|{{#if:{{SUBPAGENAME}} overview|{{#ifexist:{{SUBPAGENAME}}|{{SUBPAGENAME}}|Pier}}|}}}} {{#if:{{{image|}}}||overview.png}}|800px|link=]]
 
{{#if:{{{area1|}}}|<div class="marker" style="left: {{{x1}}}; top: {{{y1}}};"><div>1</div><div class="label">{{{area1}}}</div></div>|}}{{#if:{{{area2|}}}|<div class="marker" style="left: {{{x2}}}; top: {{{y2}}};"><div>2</div><div class="label">{{{area2}}}</div></div>|}}{{#if:{{{area3|}}}|<div class="marker" style="left: {{{x3}}}; top: {{{y3}}};"><div>3</div><div class="label">{{{area3}}}</div></div>|}}{{#if:{{{area4|}}}|<div class="marker" style="left: {{{x4}}}; top: {{{y4}}};"><div>4</div><div class="label">{{{area4}}}</div></div>|}}{{#if:{{{area5|}}}|<div class="marker" style="left: {{{x5}}}; top: {{{y5}}};"><div>5</div><div class="label">{{{area5}}}</div></div>|}}{{#if:{{{area6|}}}|<div class="marker" style="left: {{{x6}}}; top: {{{y6}}};"><div>6</div><div class="label">{{{area6}}}</div></div>|}}{{#if:{{{area7|}}}|<div class="marker" style="left: {{{x7}}}; top: {{{y7}}};"><div>7</div><div class="label">{{{area7}}}</div></div>|}}{{#if:{{{area8|}}}|<div class="marker" style="left: {{{x8}}}; top: {{{y8}}};"><div>8</div><div class="label">{{{area8}}}</div></div>|}}{{#if:{{{area9|}}}|<div class="marker" style="left: {{{x9}}}; top: {{{y9}}};"><div>9</div><div class="label">{{{area9}}}</div></div>|}}{{#if:{{{area10|}}}|<div class="marker" style="left: {{{x10}}}; top: {{{y10}}};"><div>10</div><div class="label">{{{area10}}}</div></div>|}}{{#if:{{{area11|}}}|<div class="marker" style="left: {{{x11}}}; top: {{{y11}}};"><div>11</div><div class="label">{{{area11}}}</div></div>|}}{{#if:{{{area12|}}}|<div class="marker" style="left: {{{x12}}}; top: {{{y12}}};"><div>12</div><div class="label">{{{area12}}}</div></div>|}}{{#if:{{{area13|}}}|<div class="marker" style="left: {{{x13}}}; top: {{{y13}}};"><div>13</div><div class="label">{{{area13}}}</div></div>|}}{{#if:{{{area14|}}}|<div class="marker" style="left: {{{x14}}}; top: {{{y14}}};"><div>14</div><div class="label">{{{area14}}}</div></div>|}}{{#if:{{{area15|}}}|<div class="marker" style="left: {{{x15}}}; top: {{{y15}}};"><div>15</div><div class="label">{{{area15}}}</div></div>|}}{{#if:{{{area16|}}}|<div class="marker" style="left: {{{x16}}}; top: {{{y16}}};"><div>16</div><div class="label">{{{area16}}}</div></div>|}}{{#if:{{{area17|}}}|<div class="marker" style="left: {{{x17}}}; top: {{{y17}}};"><div>17</div><div class="label">{{{area17}}}</div></div>|}}{{#if:{{{area18|}}}|<div class="marker" style="left: {{{x18}}}; top: {{{y18}}};"><div>18</div><div class="label">{{{area18}}}</div></div>|}}{{#if:{{{area19|}}}|<div class="marker" style="left: {{{x19}}}; top: {{{y19}}};"><div>19</div><div class="label">{{{area19}}}</div></div>|}}{{#if:{{{area20|}}}|<div class="marker" style="left: {{{x20}}}; top: {{{y20}}};"><div>20</div><div class="label">{{{area20}}}</div></div>|}}
 
{{#if:{{{area1|}}}|<div class="marker" style="left: {{{x1}}}; top: {{{y1}}};"><div>1</div><div class="label">{{{area1}}}</div></div>|}}{{#if:{{{area2|}}}|<div class="marker" style="left: {{{x2}}}; top: {{{y2}}};"><div>2</div><div class="label">{{{area2}}}</div></div>|}}{{#if:{{{area3|}}}|<div class="marker" style="left: {{{x3}}}; top: {{{y3}}};"><div>3</div><div class="label">{{{area3}}}</div></div>|}}{{#if:{{{area4|}}}|<div class="marker" style="left: {{{x4}}}; top: {{{y4}}};"><div>4</div><div class="label">{{{area4}}}</div></div>|}}{{#if:{{{area5|}}}|<div class="marker" style="left: {{{x5}}}; top: {{{y5}}};"><div>5</div><div class="label">{{{area5}}}</div></div>|}}{{#if:{{{area6|}}}|<div class="marker" style="left: {{{x6}}}; top: {{{y6}}};"><div>6</div><div class="label">{{{area6}}}</div></div>|}}{{#if:{{{area7|}}}|<div class="marker" style="left: {{{x7}}}; top: {{{y7}}};"><div>7</div><div class="label">{{{area7}}}</div></div>|}}{{#if:{{{area8|}}}|<div class="marker" style="left: {{{x8}}}; top: {{{y8}}};"><div>8</div><div class="label">{{{area8}}}</div></div>|}}{{#if:{{{area9|}}}|<div class="marker" style="left: {{{x9}}}; top: {{{y9}}};"><div>9</div><div class="label">{{{area9}}}</div></div>|}}{{#if:{{{area10|}}}|<div class="marker" style="left: {{{x10}}}; top: {{{y10}}};"><div>10</div><div class="label">{{{area10}}}</div></div>|}}{{#if:{{{area11|}}}|<div class="marker" style="left: {{{x11}}}; top: {{{y11}}};"><div>11</div><div class="label">{{{area11}}}</div></div>|}}{{#if:{{{area12|}}}|<div class="marker" style="left: {{{x12}}}; top: {{{y12}}};"><div>12</div><div class="label">{{{area12}}}</div></div>|}}{{#if:{{{area13|}}}|<div class="marker" style="left: {{{x13}}}; top: {{{y13}}};"><div>13</div><div class="label">{{{area13}}}</div></div>|}}{{#if:{{{area14|}}}|<div class="marker" style="left: {{{x14}}}; top: {{{y14}}};"><div>14</div><div class="label">{{{area14}}}</div></div>|}}{{#if:{{{area15|}}}|<div class="marker" style="left: {{{x15}}}; top: {{{y15}}};"><div>15</div><div class="label">{{{area15}}}</div></div>|}}{{#if:{{{area16|}}}|<div class="marker" style="left: {{{x16}}}; top: {{{y16}}};"><div>16</div><div class="label">{{{area16}}}</div></div>|}}{{#if:{{{area17|}}}|<div class="marker" style="left: {{{x17}}}; top: {{{y17}}};"><div>17</div><div class="label">{{{area17}}}</div></div>|}}{{#if:{{{area18|}}}|<div class="marker" style="left: {{{x18}}}; top: {{{y18}}};"><div>18</div><div class="label">{{{area18}}}</div></div>|}}{{#if:{{{area19|}}}|<div class="marker" style="left: {{{x19}}}; top: {{{y19}}};"><div>19</div><div class="label">{{{area19}}}</div></div>|}}{{#if:{{{area20|}}}|<div class="marker" style="left: {{{x20}}}; top: {{{y20}}};"><div>20</div><div class="label">{{{area20}}}</div></div>|}}
  
Line 75: Line 75:
 
__NOTOC__
 
__NOTOC__
 
{{doc begin}}
 
{{doc begin}}
== Usage ==
+
== Description ==
 
This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear, accompanied by a scrollable list with each location.
 
This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear, accompanied by a scrollable list with each location.
* In order to avoid cluttering articles, '''ALWAYS''' create the template as a subpage of the map locations template and then include the template into the source article of the respective map. If you are new to using templates, see Wikipedia's ''[[w:Help:A_quick_guide_to_templates|A quick guide to templates]]''.
+
: In order to avoid cluttering articles, '''ALWAYS''' create the template as a subpage of the map locations template and then include the template into the source article of the respective map under the proper section, which would be at the bottom of the "Locations" section.
** The map example used here is the map [[Pier]]. The naming convention would then be: '''Template:Map locations/Pier'''.
+
:: For instance: [[Pier#Locations]]
 +
:If you are new to using templates, see Wikipedia's ''[[w:Help:A_quick_guide_to_templates|A quick guide to templates]]''.
 +
: The map example used here is the map [[Pier]]. The naming convention would then be: '''Template:Map locations/Pier'''.
 +
: Some map titles like [[Brimstone (map)]] will contain '''(map)''' and so will the file name of the map overview image. However, as this template is meant solely for maps it is unnecessary to name it as such and should be avoided.
 +
:: '''Important:''' Map overview images with titles that contain '''(map)''' must be overridden using the <code>image</code> parameter. Remember to type in the full file name, like so: <code>image = Brimstone (map) overview.png</code>
  
  
This template's parameters are:
+
=== Parameters ===
* <span style="color:green;">(optional)</span> <code>title</code> - Title of the box. Will automatically fetch the title of the subpage. Can be used to overide the title.
+
; ''title''
* <span style="color:green;">(optional)</span> <code>collapsed</code> - Collapses the box on load. Off by default. Use <code>collapsed = yes</code> to collapse the box.
+
: Optional. Title of the box. Will automatically fetch the title of the subpage. Can be used to overide the title.
* <span style="color:green;">(optional)</span> <code>image</code> - File name of the image to be used as the base for the map location template. The image will be fetched automatically and resized to a width of 800 pixels.
+
; ''collapsed''
* <span style="color:green;">(optional)</span> <code>placement</code> - The placement of the image. Has 2 values: <code>left</code> and <code>right</code>. The image will be placed to the left by default. Please only use this to invert the image placement if there is more than one map locations template present.
+
: Optional. Collapses the box on load. Off by default. Use <code>collapsed = yes</code> to collapse the box.
* You can add up to 20 locations on the map. Every location is controlled by three main attributes. Each location will then automatically be added to a bulleted list in numeric order.
+
; ''image''
** <span style="color:red;">(required)</span> <code>area''1''</code> - Name of a given area/location. Adds the respective number to the marker automatically.
+
: Optional. File name of the image to be used as the base for the map location template. The image will be fetched automatically and resized to a width of 800 pixels. Can be used to override the image.
*** <span style="color:red;">(required if ''area'' is set)</span> <code>x''1''</code> and <code>y''1''</code> - X and Y coordinates of the [[:File:Map marker locations icon.png|map marker]]. The number is to be replaced with a number from the range (1-20).
+
; ''placement''
* You can add up to 5 spawn points on the map. Every spawn point is controlled by three main attributes. Each spawn point will then automatically be added to a bulleted list in alphabetical order.
+
: Optional. The placement of the image. Has 2 values: <code>left</code> and <code>right</code>. The image will be placed to the left by default. Please only use this to invert the image placement if there is more than one map locations template present.
** <span style="color:green;">(optional)</span> <code>spawn''1''</code> - Name of a given spawn point. Adds the respective letter to the marker automatically.
+
 
*** <span style="color:red;">(required if ''spawn'' is set)</span> <code>x''A''</code> and <code>y''A''</code> - X and Y coordinates of the [[:File:Map marker spawn icon.png|spawn point marker]]. The secondary letter is to be replaced with a letter from the range (A-E), and that letter '''must''' be capitalized, as it is case-sensitive.
+
 
*** <span style="color:red;">(required if ''spawn'' is set)</span> <code>spawn-color''1'' = <value></code> - The marker color value of the given spawn point. There are 3 marker color values: <code>red</code> (default), <code>blu</code> and <code>mix</code>. The marker color value <code>mix</code> are only to be used to indicate shared spawn rooms, as in the case with some [[Payload]] maps.
+
You can add up to 20 locations on the map. Every location is controlled by three main attributes. Each location will then automatically be added to a bulleted list in numeric order.
 +
; area''1''
 +
: Required. Contains the name of a given area/location. Adds the respective number to the marker automatically.
 +
:: <code>x''1''</code> and <code>y''1''</code> - X and Y coordinates of the [[:File:Map marker locations icon.png|map marker]]. The number is to be replaced with a number from the range (1-20).
 +
 
 +
You can add up to 5 spawn points on the map. Every spawn point is controlled by three main attributes. Each spawn point will then automatically be added to a bulleted list in alphabetical order.
 +
; spawn''1''
 +
: Optional. Contains the name of a given spawn point. Adds the respective letter to the marker automatically.
 +
:: <code>x''A''</code> and <code>y''A''</code> - X and Y coordinates of the [[:File:Map marker spawn icon.png|spawn point marker]]. The secondary letter is to be replaced with a letter from the range (A-E), and that letter '''must''' be capitalized, as it is case-sensitive.
 +
; spawn-color''1''
 +
: Required if ''spawn'' is set. The marker color value of the given spawn point. There are 3 marker color values: <code>red</code> (default), <code>blu</code> and <code>mix</code>. The marker color value <code>mix</code> are only to be used to indicate shared spawn rooms, as in the case with some maps.
  
 
== Translation ==
 
== Translation ==
Translations for this template may be added under [[Template:Dictionary/common strings#map_locations_.28template.29]].
+
Translations for this template can be added under [[Template:Dictionary/common strings#map_locations_.28template.29]].
 
 
== Special cases ==
 
Some map titles like [[Brimstone (map)]] will contain <code>(map)</code> and so will the file name of the map overview image. However, as this template is meant solely for maps it is unnecessary to name it as such and should be avoided.
 
* '''Important:''' Maps that end with <code>(map)</code> must be overridden using the <code>title</code> parameter. You only need to type in the map title, not the whole file name.
 
==== Example ====
 
<span style="color:green;">Correct</span><br>
 
<code>
 
title = Brimstone (map)
 
</code>
 
<br><br>
 
<span style="color:red;">Incorrect</span><br>
 
<code>
 
title = Brimstone (map) overview
 
</code>
 
  
 
== Getting the coordinates ==
 
== Getting the coordinates ==
Line 123: Line 123:
 
<pre>
 
<pre>
 
{{User:Wookipan/Map overview
 
{{User:Wookipan/Map overview
 +
| title = Pier
 +
| image = Pier overview.png
 +
|-
 
  | spawn1 = BLU first spawn
 
  | spawn1 = BLU first spawn
 
  | spawn-color1 = blu
 
  | spawn-color1 = blu
Line 190: Line 193:
  
 
{{User:Wookipan/Map overview
 
{{User:Wookipan/Map overview
 +
| title = Pier
 +
| image = Pier overview.png
 +
|-
 
  | spawn1 = BLU first spawn
 
  | spawn1 = BLU first spawn
 
  | spawn-color1 = blu
 
  | spawn-color1 = blu

Revision as of 22:48, 10 January 2022


Documentation for Wookipan/Map overview

Description

This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear, accompanied by a scrollable list with each location.

In order to avoid cluttering articles, ALWAYS create the template as a subpage of the map locations template and then include the template into the source article of the respective map under the proper section, which would be at the bottom of the "Locations" section.
For instance: Pier#Locations
If you are new to using templates, see Wikipedia's A quick guide to templates.
The map example used here is the map Pier. The naming convention would then be: Template:Map locations/Pier.
Some map titles like Brimstone (map) will contain (map) and so will the file name of the map overview image. However, as this template is meant solely for maps it is unnecessary to name it as such and should be avoided.
Important: Map overview images with titles that contain (map) must be overridden using the image parameter. Remember to type in the full file name, like so: image = Brimstone (map) overview.png


Parameters

title
Optional. Title of the box. Will automatically fetch the title of the subpage. Can be used to overide the title.
collapsed
Optional. Collapses the box on load. Off by default. Use collapsed = yes to collapse the box.
image
Optional. File name of the image to be used as the base for the map location template. The image will be fetched automatically and resized to a width of 800 pixels. Can be used to override the image.
placement
Optional. The placement of the image. Has 2 values: left and right. The image will be placed to the left by default. Please only use this to invert the image placement if there is more than one map locations template present.


You can add up to 20 locations on the map. Every location is controlled by three main attributes. Each location will then automatically be added to a bulleted list in numeric order.

area1
Required. Contains the name of a given area/location. Adds the respective number to the marker automatically.
x1 and y1 - X and Y coordinates of the map marker. The number is to be replaced with a number from the range (1-20).

You can add up to 5 spawn points on the map. Every spawn point is controlled by three main attributes. Each spawn point will then automatically be added to a bulleted list in alphabetical order.

spawn1
Optional. Contains the name of a given spawn point. Adds the respective letter to the marker automatically.
xA and yA - X and Y coordinates of the spawn point marker. The secondary letter is to be replaced with a letter from the range (A-E), and that letter must be capitalized, as it is case-sensitive.
spawn-color1
Required if spawn is set. The marker color value of the given spawn point. There are 3 marker color values: red (default), blu and mix. The marker color value mix are only to be used to indicate shared spawn rooms, as in the case with some maps.

Translation

Translations for this template can be added under Template:Dictionary/common strings#map_locations_.28template.29.

Getting the coordinates

To make the process as easy and simple as possible without the need of image editing software, it is highly recommended to use the built-in developer tools in various browsers, to ajust the marker placements with ease.

  • Once an area or spawn point has been defined with both its X and Y parameters, the marker will be placed at the very bottom of the box, simply because it has not yet been given any coordinate values. You can ajust the coordinates while editing by using the Show preview feature. Use the guide below accustomed to your browser.

For Google Chrome/Chromium & Firefox users

  • Right-click on the marker and select 'Inspect' (usually at the bottom). Once the inspector is open, select the parent element of the marker if not already selected. The element in question is: <div class="marker" style="left: ; top: ;"></div>
  • In the right side is a window divided into sections, with the first being element.style (or element in Firefox) which contains the coordinate values. In this guide, it is assumed that no values have been added, and to add them you must click on both left and top individually and press tab. Once done, simply add a value like 120px and see if the marker changes position. It is important that you add px at the end of the value without a space, as it is used to define the unit type, which must be in pixels in this case. You can click on the value and use the up/down arrow keys to rapidly increase/decrease the pixel value. Once the marker is at a fitting position, copy the entire value and add it to the proper parameter.
    • Remember: left is for X coordinates, and top is for Y coordinates.

Example

{{User:Wookipan/Map overview
 | title = Pier
 | image = Pier overview.png
 |-
 | spawn1 = BLU first spawn
 | spawn-color1 = blu
 | xA = 335px
 | yA = 150px
 | spawn2 = BLU second spawn
 | spawn-color2 = blu
 | xB = 193px
 | yB = 230px
 | spawn3 = RED first spawn / BLU third spawn
 | spawn-color3 = mix
 | xC = 245px
 | yC = 400px
 | spawn4 = RED final spawn
 | spawn-color4 = red
 | xD = 608px
 | yD = 512px
 |-
 | area1 = Beach
 | x1 = 210px
 | y1 = 120px
 | area2 = Caves
 | x2 = 285px
 | y2 = 230px
 | area3 = Minivan parking space
 | x3 = 280px
 | y3 = 290px
 | area4 = Cliff
 | x4 = 240px
 | y4 = 220px
 | area5 = Bridge
 | x5 = 200px
 | y5 = 320px
 | area6 = Red carpet building
 | x6 = 160px
 | y6 = 350px
 | area7 = Wine cellar
 | x7 = 90px
 | y7 = 390px
 | area8 = Docks
 | x8 = 135px
 | y8 = 520px
 | area9 = Warehouse
 | x9 = 305px
 | y9 = 480px
 | area10 = Kitchen
 | x10 = 340px
 | y10 = 410px
 | area11 = Sandy beach
 | x11 = 425px
 | y11 = 460px
 | area12 = Barn bridge
 | x12 = 430px
 | y12 = 400px
 | area13 = Small barn
 | x13 = 468px
 | y13 = 425px
 | area14 = Building adjacent to the barn
 | x14 = 505px
 | y14 = 460px
 | area15 = Target range
 | x15 = 600px
 | y15 = 460px
}}

will yield