Help:MahjongTile

From Japanese mahjong wiki
Revision as of 01:50, 31 July 2013 by Bps (talk | contribs) (almost done)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MahjongTile is a MediaWiki extension that makes it easy to output sequences of mahjong tile images, for example:

Tile-1m.pngTile-9m.pngTile-1p.pngTile-9p.pngTile-1s.pngTile-9s.pngTile-1z.pngTile-2z.pngTile-3z.pngTile-4z.png Tile-questionmark.pngTile-questionmark.pngTile-questionmark.png

by use of the parser function #mjt. Specifically, it converts tile strings into their corresponding sequence of wiki markup image insertions, e.g.:

19p -> [[File:Tile-1p.png]][[File:Tile-9p.png]]

The rest of this article describes how to use it.

Usage

The command can be invoked at any point in the wiki markup.

Syntax

{{ #mjt: tile string | size option }}

Tile string

The tile string is similar to the way people communicate strings of tiles through text. First, an example, and its output:

Code Result
{{#mjt: 123m}}
Tile-1m.pngTile-2m.pngTile-3m.png

The 123 part is self-explanatory, and the m part stands for man. 123m is called the tile string.

In general, a tile sequence consists of a series of digits (0 through 9) followed by a descriptor character describing which set they belong to. There are four groups:

Group Descriptor Full array (code) Full array
Man m
{{#mjt: 0123456789m}}
Tile-0m.pngTile-1m.pngTile-2m.pngTile-3m.pngTile-4m.pngTile-5m.pngTile-6m.pngTile-7m.pngTile-8m.pngTile-9m.png
Pin p
{{#mjt: 0123456789p}}
Tile-0p.pngTile-1p.pngTile-2p.pngTile-3p.pngTile-4p.pngTile-5p.pngTile-6p.pngTile-7p.pngTile-8p.pngTile-9p.png
Sou s
{{#mjt: 0123456789s}}
Tile-0s.pngTile-1s.pngTile-2s.pngTile-3s.pngTile-4s.pngTile-5s.pngTile-6s.pngTile-7s.pngTile-8s.pngTile-9s.png
Jihai z
{{#mjt: 0123456789z}}
Tile-unknown.pngTile-1z.pngTile-2z.pngTile-3z.pngTile-4z.pngTile-5z.pngTile-6z.pngTile-7z.pngTile-whitespace.pngTile-questionmark.png

More complex configurations can also be described, by simply concatenating strings like above. Another example:

Code Result
{{#mjt: 456m789s}}
Tile-4m.pngTile-5m.pngTile-6m.pngTile-7s.pngTile-8s.pngTile-9s.png

Spaces in a tile string are also ignored, so the following are equivalent:

123m1111z
123m 1111z
123m     1111z
1 23m1111z
123m11 11z
12 3m1111    z
1 23  m1 11 1z
...

The jihai group (see the table above) can also be used to refer to "unknown" or "face-down" tiles, as is often convenient when describing certain components of a hand. Example:

Code Result
The iipeikou yaku looks something like:

{{#mjt: 345345m00000000z}}
The iipeikou yaku looks something like:

Tile-3m.pngTile-4m.pngTile-5m.pngTile-3m.pngTile-4m.pngTile-5m.pngTile-unknown.pngTile-unknown.pngTile-unknown.pngTile-unknown.pngTile-unknown.pngTile-unknown.pngTile-unknown.pngTile-unknown.png

Tile orientation

There are additional flags that can be applied to specific tiles or entire tile groupings that adjust their orientation.

Orientation Flag
Sideways ("pointing east/right") '
Sideways ("pointing west/left") "

These can be applied after a digit, affecting that individual tile only, or after a descriptor, then affecting the entire sequence of tiles in that grouping. The following examples should make this clear:

Code Result Comment
{{#mjt: 123m4'5"6m789m'}}
Tile-1m.pngTile-2m.pngTile-3m.pngTile-4m-e.pngTile-5m-k.pngTile-6m.pngTile-7m-e.pngTile-8m-e.pngTile-9m-e.png This meaningless example shows the two ways in which the flags can be placed.
{{#mjt: 444m22p123678s}} {{#mjt: 111'z}}
Tile-4m.pngTile-4m.pngTile-4m.pngTile-2p.pngTile-2p.pngTile-1s.pngTile-2s.pngTile-3s.pngTile-6s.pngTile-7s.pngTile-8s.png Tile-1z.pngTile-1z.pngTile-1z-e.png This more realistic example demonstrates how the feature might actually be used. Note the two commands separated by a space, for readability.
{{#mjt: 1"33s'}} {{#mjt: 37'7s"}}
Tile-1s-k.pngTile-3s-e.pngTile-3s-e.png Tile-3s-k.pngTile-7s-e.pngTile-7s-k.png Here we see how the individually set orientation overrides the grouping orientation. This is just how it works, it's not indended for any magical purpose. It is probably more efficient.

Size option

This is the size option you would pass to any image. First, an explanation with a regular image:

Code Result
[[File:Canard_plastique.jpg|200px]]
200px


Full list of tile images available

Tile-1m.pngTile-2m.pngTile-3m.pngTile-4m.pngTile-5m.pngTile-6m.pngTile-7m.pngTile-8m.pngTile-9m.pngTile-0m.png Tile-1m-e.pngTile-2m-e.pngTile-3m-e.pngTile-4m-e.pngTile-5m-e.pngTile-6m-e.pngTile-7m-e.pngTile-8m-e.pngTile-9m-e.pngTile-0m-e.png Tile-1m-k.pngTile-2m-k.pngTile-3m-k.pngTile-4m-k.pngTile-5m-k.pngTile-6m-k.pngTile-7m-k.pngTile-8m-k.pngTile-9m-k.pngTile-0m-k.png

Tile-1p.pngTile-2p.pngTile-3p.pngTile-4p.pngTile-5p.pngTile-6p.pngTile-7p.pngTile-8p.pngTile-9p.pngTile-0p.png Tile-1p-e.pngTile-2p-e.pngTile-3p-e.pngTile-4p-e.pngTile-5p-e.pngTile-6p-e.pngTile-7p-e.pngTile-8p-e.pngTile-9p-e.pngTile-0p-e.png Tile-1p-k.pngTile-2p-k.pngTile-3p-k.pngTile-4p-k.pngTile-5p-k.pngTile-6p-k.pngTile-7p-k.pngTile-8p-k.pngTile-9p-k.pngTile-0p-k.png

Tile-1s.pngTile-2s.pngTile-3s.pngTile-4s.pngTile-5s.pngTile-6s.pngTile-7s.pngTile-8s.pngTile-9s.pngTile-0s.png Tile-1s-e.pngTile-2s-e.pngTile-3s-e.pngTile-4s-e.pngTile-5s-e.pngTile-6s-e.pngTile-7s-e.pngTile-8s-e.pngTile-9s-e.pngTile-0s-e.png Tile-1s-k.pngTile-2s-k.pngTile-3s-k.pngTile-4s-k.pngTile-5s-k.pngTile-6s-k.pngTile-7s-k.pngTile-8s-k.pngTile-9s-k.pngTile-0s-k.png

Tile-1z.pngTile-2z.pngTile-3z.pngTile-4z.pngTile-5z.pngTile-6z.pngTile-7z.pngTile-unknown.png Tile-1z-e.pngTile-2z-e.pngTile-3z-e.pngTile-4z-e.pngTile-5z-e.pngTile-6z-e.pngTile-7z-e.pngTile-unknown-e.png Tile-1z-k.pngTile-2z-k.pngTile-3z-k.pngTile-4z-k.pngTile-5z-k.pngTile-6z-k.pngTile-7z-k.pngTile-unknown-k.png