Ad placeholder

Template:ResourceHelper: Difference between revisions

Jump to navigation Jump to search
Use lvar for locally scoped variables instead
(Changed the input format to "type:count" instead of "count type")
(Use lvar for locally scoped variables instead)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
Handle resources in the format of [count] <resource> e.g. "ki:4" or just "ki"
Handle resources in the format of [count] <resource> e.g. "ki:4" or just "ki"
-->{{#vardefine: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 :
-->{{#vardefine:count|{{ #explode: {{{1}}}|:|1}}}}<!--
-->{{#lvardef:count|{{ #explode: {{{1}}}|:|1}}}}<!--
-->{{#if: {{#var: count}}
-->{{#if: {{#lvar: count}}
   | {{resource|{{#var: type}}|count={{#var: count}}}}
   | {{resource|{{#lvar: type}}|count={{#lvar: count}}}}
   | {{resource|{{#var: type}}}}
   | {{resource|{{#lvar: type}}}}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
=What is this?=
=What is this?=
Line 24: Line 24:
! Input
! Input
|-
|-
|{{ResourceSimple|ki}}||<pre>{{ResourceSimple|ki}}</pre>
|{{ResourceHelper|ki}}||<pre>{{ResourceHelper|ki}}</pre>
|-
|-
|{{ResourceSimple|ki:5}}||<pre>{{ResourceSimple|ki:5}}</pre>
|{{ResourceHelper|ki:5}}||<pre>{{ResourceHelper|ki:5}}</pre>
|-
|-
|{{ResourceSimple|movement:30}}||<pre>{{ResourceSimple|movement:30}}</pre>
|{{ResourceHelper|movement:30}}||<pre>{{ResourceHelper|movement:30}}</pre>
|-
|-
| {{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceSimple }}
| {{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceHelper }}
| <pre>{{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceSimple }}</pre>
| <pre>{{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceHelper }}</pre>
|-
|-
| {{#invoke: ParseList | main  
| {{#invoke: ParseList | main  
   | bonus, movement:10 | useTemplate = ResourceSimple
   | bonus, movement:10 | useTemplate = ResourceHelper
}}
}}
| <pre>
| <pre>
{{#invoke: ParseList | main
{{#invoke: ParseList | main
   | bonus, movement:10 | useTemplate = ResourceSimple
   | bonus, movement:10 | useTemplate = ResourceHelper
}}
}}
</pre>
</pre>
|}
|}
</noinclude>
</noinclude>

Navigation menu