Template:CountItem: Difference between revisions

From A KoL Wiki
imported>Fig bucket
Created page with "<includeonly><div class="countItem-{{{2|0}}}-{{{1}}}" style="display:none;"></div></includeonly><noinclude> {{Code2}} Adds an invisible counter which can be used to generate..."
 
imported>Fig bucket
m revise this
 
Line 1: Line 1:
<includeonly><div class="countItem-{{{2|0}}}-{{{1}}}" style="display:none;"></div></includeonly><noinclude>
<includeonly><div class="countable countable-{{{1|0}}} {{#if:{{{2|}}}|countable-{{{2}}}}} {{#if:{{{3|}}}|countable-{{{3}}}}}" style="display:none;"></div></includeonly><noinclude>
{{Code2}}
{{Code2}}


Line 5: Line 5:


==Usage==
==Usage==
*<nowiki>{{CountItem|n|m}}</nowiki>
*<nowiki>{{CountItem|group1|group2|group3}}</nowiki>
**The first argument <code>n</code> is required, and indicates which the counter that this applies to.  Counters are numeric values, starting at 0.
** Countable things are organized by groupsGroup names are lower-case, alphanumeric values. An item can be in up to 3 groups; if no group is specified the default group is "0".
**The second argument <code>m</code> is optionalCounters are divided into sets, so you can produce distinct sums for different groupings of counters.  Counter sets are also numeric values, starting at 0. The default is 0.
* See {{tl|CountTotal}} for creating the sum of items in a specific group (or set of groups).
* Note that both counters (the <code>n</code> values) and sets (the <code>m</code> values) require you use numbers in order, with no gaps.  So you cannot use counter (or set) 3 without using counters (sets) 0, 1, and 2 as well.
* See {{tl|CountTotal}} for creating the sum of a specific counter, and {{tl|CountTotalTotal}} for summing all counters within a set.


[[Category:Utility Templates|{{PAGENAME}}]]
[[Category:Utility Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Latest revision as of 17:21, 10 July 2016

<div class="countable countable-{{{1|0}}} {{#if:{{{2|}}}|countable-{{{2}}}}} {{#if:{{{3|}}}|countable-{{{3}}}}}" style="display:none;"></div>

Adds an invisible counter which can be used to generate sums automatically in a page. Use one of these for each item you want to count in a page.

Usage

  • {{CountItem|group1|group2|group3}}
    • Countable things are organized by groups. Group names are lower-case, alphanumeric values. An item can be in up to 3 groups; if no group is specified the default group is "0".
  • See {{CountTotal}} for creating the sum of items in a specific group (or set of groups).