Template:Duration: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(updated to handle 1-turn and permanent durations)
(Updated documentation and added more robust case-insensitive handling of special durations)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<includeonly>{{SmallIcon|Duration Icons.png}} Duration: {{{1}}} {{#switch:{{{1|}}} | 1 = turn | Permanent = | permanent = | #default = turns}}</includeonly><noinclude>
<includeonly>{{SmallIcon|Duration Icons.png|class=bg3wiki-lightmode-drop-shadow}} Duration: {{#switch:{{lc:{{{1}}}}}
Provide a number (in turns) and display that duration.
| 1 = 1 turn
| permanent = Permanent
| short rest
| until short rest = Until [[short rest]]
| long rest
| until long rest = Until [[Long rest]]
| saving throw
| until saving throw = Until successful [[Saving Throw]]
| surface
| whilst on surface = Whilst on surface
| #default = {{{1}}} turns
}}</includeonly><noinclude>{{documentation|content=
__NOTOC__
Display a nicely formatted duration.


== Usage Examples ==
The duration can be a number of turns or one of the special values below:
Usage:
* {{c|Permanent}}
<pre><nowiki>{{Duration|1}}</nowiki></pre>
* {{c|Until short rest}} or {{c|Short rest}}
* {{c|Until long rest}} or {{c|Long rest}}
* {{c|Until saving throw}} or {{c|Saving throw}}
* {{c|Surface}} or {{c|Whilst on surface}}
These special values are not case sensitive.


Result:
== Examples ==
{{Duration|1}}
{{Template demo
----
| <nowiki>{{Duration|1}}</nowiki>
Usage:
| <nowiki>{{Duration|5}}</nowiki>
<pre><nowiki>{{Duration|3}}</nowiki></pre>
| <nowiki>{{Duration|Until Long Rest}}</nowiki>
| <nowiki>{{Duration|PERMANENT}}</nowiki>
| <nowiki>{{Duration|Whilst on surface}}</nowiki>
| <nowiki>{{Duration|Saving Throw}}</nowiki>
}}


Result:
== Template data ==
{{Duration|3}}
<templatedata>
----
{
Alternative usage for '''Permanent''' duration:
    "description": "Display a nicely formatted duration",
<pre><nowiki>{{Duration|Permanent}}</nowiki></pre>
    "format": "inline",
 
"params": {
Result:
"1": {
{{Duration|Permanent}}
"description": "Duration specified as a number of turns or one of the special values below.",
            "suggestedvalues": ["Permanent", "Short rest", "Until short rest", "Long rest", "Until long rest", "Saving throw", "Until saving throw", "Surface", "Whilst on surface"],
"required": true,
"label": "duration",
"type": "string"
}
}
}
</templatedata>}}


</noinclude>
</noinclude>

Latest revision as of 00:34, 22 July 2024

Template documentation

Display a nicely formatted duration.

The duration can be a number of turns or one of the special values below:

  • Permanent
  • Until short rest or Short rest
  • Until long rest or Long rest
  • Until saving throw or Saving throw
  • Surface or Whilst on surface

These special values are not case sensitive.

Examples

Markup Renders as
{{Duration|1}}
Duration: 1 turn
{{Duration|5}}
Duration: 5 turns
{{Duration|Until Long Rest}}
Duration: Until Long rest
{{Duration|PERMANENT}}
Duration: Permanent
{{Duration|Whilst on surface}}
Duration: Whilst on surface
{{Duration|Saving Throw}}
Duration: Until successful Saving Throw

Template data

Display a nicely formatted duration

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
duration1

Duration specified as a number of turns or one of the special values below.

Suggested values
Permanent Short rest Until short rest Long rest Until long rest Saving throw Until saving throw Surface Whilst on surface
Stringrequired