Template:ResourceIconHelper: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(Fixed errant linebreak in ResourceIconList with multiple resources)
(Fix to use new movement cost syntax.)
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
-->{{#lvardef:type|{{ #explode: {{{1}}}|:|0}}}}<!--
-->{{#lvardef:type|{{ #explode: {{{1}}}|:|0}}}}<!--
Split parameter into type and count on the :
Split parameter into type and count on the :
-->{{resource|{{#lvar: type}}|icononly=yes}}</includeonly><noinclude>
-->{{#lvardef:count|{{ #explode: {{{1}}}|:|1}}}}{{resource|{{#lvar: type}}|{{#switch: {{#lvar: type}} | movement = | #default = {{#lvar: count}}}}|icononly=yes}}</includeonly><noinclude>
=What is this?=
=What is this?=
This is a wrapper around [[Template:Resource]] to work better in conjunction with [[Module:ParseList]] specifically by [[Template:ResourceIconList]].
This is a wrapper around [[Template:Resource]] to work better in conjunction with [[Module:ParseList]] specifically by [[Template:ResourceIconList]].
Line 20: Line 20:
! Input
! Input
|-
|-
|{{ResourceIconHelper|action|this is an example=yes}}||<pre>{{ResourceIconHelper|ki}}</pre>
|{{ResourceIconHelper|rage|this is an example=yes}}||<pre>{{ResourceIconHelper|rage}}</pre>
|-
|-
|{{ResourceIconHelper|bonus:5|this is an example=yes}}||<pre>{{ResourceIconHelper|ki:5}}</pre>
|{{ResourceIconHelper|ki:5|this is an example=yes}}||<pre>{{ResourceIconHelper|ki:5}}</pre>
|-
|-
|{{ResourceIconHelper|movement:30|this is an example=yes}}||<pre>{{ResourceIconHelper|movement:30}}</pre>
|{{ResourceIconHelper|movement m:9|this is an example=yes}}||<pre>{{ResourceIconHelper|movement m:9}}</pre>
|-
|-
|}
|}
</noinclude>
</noinclude>

Latest revision as of 05:44, 8 April 2024

What is this?

This is a wrapper around Template:Resource to work better in conjunction with Module:ParseList specifically by Template:ResourceIconList.

Optional parameters like cost=3 do not work when applying a template to a list with ParseList, so this template enables an alternative syntax that can be used with ParseList.

Usage

{{ResourceIconHelper | <type>:[count]}}


<> Denotes mandatory parameters, [] denotes optional parameters.

Refer to Template:Resource for a list of the handled resource types.

Examples

Output Input
{{ResourceIconHelper|rage}}
5
{{ResourceIconHelper|ki:5}}
9 m / 30 ft
{{ResourceIconHelper|movement m:9}}