Work in progress — This wiki is an active migration / mirror of Homestar Runner Wiki and is not finished yet. Account registration and public editing are turned off until the migration is further along. For status updates, see the migration thread on the forums.

HRWiki Counter

From HR Wiki Twice
Revision as of 01:53, 14 July 2026 by imported>HRWikiMirrorBot (Imported from hrwiki.org via Wayback Machine (HTML→wikitext))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  • [#Usage 1 Usage]
  • [#Examples 2 Examples]
  • [#Sortable_Tables 3 Sortable Tables]

Usage

increment}} Increments the counter id by increment and displays the result; increment can be omitted, and defaults to 1.
value|increment}} Silently sets the counter id to value minus increment (so that the next count by increment will display value); value and increment can be omitted, and both default to 1.
{{hcount}}

{{vcount}}

Used in sortable tables. See [#Sortable_Tables below].

Examples

count is a parser function that returns an integer that increments each time the function is called:

Code Gives
{{#count:basic}} 1
{{#count:basic}} 2
{{#count:basic}} 3
{{#count:basic}} 4
{{#count:basic}} 5

The counters can be given different names, so you can have more than one of them on the same page:
(The actual name doesn't matter, so long as they're different. If you use a counter in a template, pick a name that'll be unique.)

Code Gives
{{#count:first}} 1
{{#count:second}} 1
{{#count:second}} 2
{{#count:second}} 3
{{#count:first}} 2
{{#count:second}} 4

You can also make the counter count by twos, or by any other number:

Code Gives
2}} 2
2}} 4
2}} 6
2}} 8
2}} 10

Different increments can be used at different times, depending on what is needed:

Code Gives
1}} 1
1}} 2
3}} 5
0}} 5
-1}} 4
2}} 6

The counter can be reset partway through a page:

Code Gives
{{#count:basic}} 1
{{#count:basic}} 2
{{#count:basic}} 3
{{#resetcount:basic}}
{{#count:basic}} 1
{{#count:basic}} 2
{{#count:basic}} 3

You can also set what number you want to start on:

Code Gives
11}}
{{#count:starting}} 11
{{#count:starting}} 12
{{#count:starting}} 13
{{#count:starting}} 14
{{#count:starting}} 15

If you're using an increment, you need to give it to #resetcount too:

Code Gives
14|2}}
2}} 14
2}} 16
2}} 18
2}} 20
2}} 22

Use a negative increment to count down. As noted above, be sure to pass the increment to #resetcount too:

Code Gives
3|-1}}
-1}} 3
-1}} 2
-1}} 1
-1}} 0
-1}} -1

You can use the counter in other parser functions:

Code Gives
even|odd}} odd
even|odd}} even
even|odd}} odd
even|odd}} even
even|odd}} odd
Code Gives
0}}}} 1
0}}}} 4
0}}}} 9
0}}}} 16
0}}}} 25

Sortable Tables

When using count in sortable tables, please use the {{hcount}} and {{vcount}} templates. Be sure to carefully read their documentation in order to sort table entries correctly.