Template:Distance: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
Added template demo and documentation templates
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{SmallIcon|Range Icon.png}} {{#switch:{{{1|}}}
<includeonly>{{SmallIcon|Range Icon.png}} {{#switch: {{{1|}}}
| melee | touch = {{Distance/Transform|5}}
| melee | touch = 1.5&#8239;m / 5&#8239;ft
| reach = {{Distance/Transform|8}}
| reach = 2.5&#8239;m / 8&#8239;ft
| ranged = {{Distance/Transform|60}}
| ranged = 18&#8239;m / 60&#8239;ft
| short ranged = {{Distance/Transform|50}}
| short ranged = 15&#8239;m / 50&#8239;ft
| #default = {{#if: {{{m|}}} | {{{m}}}{{nbts}}m / {{{ft}}}{{nbts}}ft <!-- Keeping for backward compatibility -->
| #default = {{#if: {{{m|}}}
   | {{Distance/Transform|{{{ft}}}}} }}
  | {{{m}}}&#8239;m / {{m to ft | {{{m}}} }}&#8239;ft
}}</includeonly><noinclude>
   | {{#expr: {{{ft|0}}} * 3 / 10 }}&#8239;m / {{{ft|0}}}&#8239;ft {{color|red|(ERROR: Distance not in metric!)}} {{Main namespace only|[[Category:Articles with incorrect usage of the Distance template]][[Category:Articles with errors]]}}
Usage: {{code|<nowiki>{{Distance|melee}}</nowiki>}}
  }}
}}</includeonly><noinclude>{{Documentation|content=
A template for displaying distances:


Result: {{Distance|melee}}
== Examples ==
{{Template demo
| style = table
| <nowiki>{{Distance|melee}}</nowiki>
| <nowiki>{{Distance|reach}}</nowiki>
| <nowiki>{{Distance|ranged}}</nowiki>
| <nowiki>{{Distance|short ranged}}</nowiki>
| <nowiki>{{Distance|m=1.5}}</nowiki>
| <nowiki>{{Distance|ft=50}}</nowiki>
}}


Usage: {{code|<nowiki>{{Distance|reach}}</nowiki>}}
Game files use metric, and apply the calculation mentioned in [[Template:M to ft]] when the options are set to imperial. This is why the template expects a value in metric and refuses to apply the reverse transform, which may lead to unexpected results due to rounding.
 
}}
Result: {{Distance|reach}}
[[Category:Templates]]
 
Usage: {{code|<nowiki>{{Distance|ranged}}</nowiki>}}
 
Result: {{Distance|ranged}}
 
Usage: {{code|<nowiki>{{Distance|short ranged}}</nowiki>}}
 
Result: {{Distance|short ranged}}
 
Usage: {{code|<nowiki>{{Distance|m=X|ft=Y}}</nowiki>}}
 
Result: {{Distance|m=X|ft=Y}}
 
Usage: {{code|<nowiki>{{Distance|ft=50}}</nowiki>}}
 
Result: {{Distance|ft=50}}
</noinclude>
</noinclude>

Latest revision as of 11:27, 19 January 2025

Template documentation

A template for displaying distances:

Examples

Markup Renders as
{{Distance|melee}}
1.5 m / 5 ft
{{Distance|reach}}
2.5 m / 8 ft
{{Distance|ranged}}
18 m / 60 ft
{{Distance|short ranged}}
15 m / 50 ft
{{Distance|m=1.5}}
1.5 m / 5 ft
{{Distance|ft=50}}
15 m / 50 ft (ERROR: Distance not in metric!)

Game files use metric, and apply the calculation mentioned in Template:M to ft when the options are set to imperial. This is why the template expects a value in metric and refuses to apply the reverse transform, which may lead to unexpected results due to rounding.