Help:MahjongTile: Difference between revisions

Jump to navigation Jump to search
m
Coppro moved page Manual:MahjongTile to Help:MahjongTile: This is a help page and should be in the corresponding namespace.
(finished now, I think)
m (Coppro moved page Manual:MahjongTile to Help:MahjongTile: This is a help page and should be in the corresponding namespace.)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''MahjongTile''' is a [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] extension that makes it easy to output sequences of mahjong tile images, for example:
'''MahjongTile''' is a [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] extension that makes it easy to output sequences of mahjong tile images, for example:


{{#mjt: 19m19p19s1234z}} {{#mjt: 999z}}
{{#mjt: 19m19p19s1234z}} {{#mjt: 000z}}


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


:''MahjongTile'' is written by [[User:Bps|bps]]. Bug reports and feature requests are always welcome.
:''MahjongTile'' is written by [[User:Bps|bps]]. Bug reports and feature requests are always welcome.
: The [[Special:Version#Installed_extensions|current version]] is 1.1.


== Usage ==
== Usage ==
Line 51: Line 53:
|-
|-
| [[Jihai]] || <code>z</code> || <pre>{{#mjt: 0123456789z}}</pre> || {{#mjt: 0123456789z}}
| [[Jihai]] || <code>z</code> || <pre>{{#mjt: 0123456789z}}</pre> || {{#mjt: 0123456789z}}
|-
| [[Paifu]] || <code>x</code> || <pre>{{#mjt: 0123456789x}}</pre> || {{#mjt: 0123456789x}}
|}
|}


Line 79: Line 83:
</pre>
</pre>


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:
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. There is also a "blank" tile image ([[File:Tile-whitespace.png]]) with the same dimensions as an ordinary tile, in case something like that is ever needed. Examples:


{| class="wikitable"
{| class="wikitable"
Line 94: Line 98:


{{#mjt: 345345m00000000z}}
{{#mjt: 345345m00000000z}}
|-
|
<pre>
''Quiz''. What is the unknown tile in the following chii group?
{{#mjt: 13m9z'}}
''Answer''. {{#mjt: 2m}}
</pre>
|| ''Quiz''. What is the unknown tile in the following chii group?
{{#mjt: 13m9z'}}
''Answer''. {{#mjt: 2m}}
|}
|}


==== Tile orientation ====
==== Tile orientation and stacking ====


There are additional flags that can be applied to specific tiles or entire tile groupings that adjust their orientation.
There are additional flags that can be applied to specific tiles or entire tile groupings that adjust their orientation, or stack them up (for [[kan]] groups).


{| class="wikitable"
{| class="wikitable"
Line 104: Line 122:
! Orientation || Flag
! Orientation || Flag
|-
|-
| Sideways ("pointing east/right")
| Sideways (pointing east/right)
| <code>'</code>
| <code>'</code>
|-
|-
| Sideways ("pointing west/left")
| Stacked (pointing west/left)
| <code>"</code>
| <code>"</code>
|}
|}
Line 119: Line 137:
|
|
<pre>
<pre>
{{#mjt: 123m4'5"6m789m'}}
{{#mjt: 123m 888p 333z 22z}} {{ #mjt: 11"1p }}
</pre>
</pre>
| {{#mjt: 123m4'5"6m789m'}}
| {{#mjt: 123m 888p 333z 22z}} {{ #mjt: 11"1p }}
| This meaningless example shows the two ways in which the flags can be placed.
| A simple winning hand involving a [[kan]] of 1-pin.
|-
|-
|
|
Line 140: Line 158:


If you can think of a reason why upside down tiles should also be implemented, let me know and I will add that too. I really can't think of a (not incredibly contrived) situation that warrants upside down tile images.
If you can think of a reason why upside down tiles should also be implemented, let me know and I will add that too. I really can't think of a (not incredibly contrived) situation that warrants upside down tile images.
'''Note'''. The old behaviour (before 2015-01-25) of the <code>"</code> flag was to make the tile point west/left. This was totally useless though, so it has been replaced with the above configuration.
=== Arrows and paifu ===
The <code>x</code> descriptor offers a number of images that may be useful in construction of [[paifu]]. Note in particular that the height of the left- and right-arrows is equal to the usual height of an upright tile, so as to achieve proper centering. The mnemonic for remembering the arrow numbers is to start from zero, and count "up, down, left, right". I think this is the most natural way to enumerate the directions, at least in spoken English.


=== Size option ===
=== Size option ===
Line 149: Line 172:
! Code || Result
! Code || Result
|-
|-
| <pre>[[File:Canard_plastique.jpg|200px]]</pre>
| <pre>[[File:13_red_x.png|50px]]</pre>
| [[File:Canard_plastique.jpg|200px]]
| [[File:13_red_x.png|50px]]
|}
|}


Line 164: Line 187:


It works a bit weird, so you should refer to [http://www.mediawiki.org/wiki/Help:Images#Size_and_frame the MediaWiki help page]. You may find you have to split up your sequence into multiple commands. If they are not separated by any whitespace, they should behave as if they were stuck together with just one command.
It works a bit weird, so you should refer to [http://www.mediawiki.org/wiki/Help:Images#Size_and_frame the MediaWiki help page]. You may find you have to split up your sequence into multiple commands. If they are not separated by any whitespace, they should behave as if they were stuck together with just one command.
=== Reserved tiles ===
Should you use a tile which has not been described above, you will get a tile like this instead: [[File:Tile-reserved.png]]. In particular, the <code>'</code>- or <code>"</code>-modified <code>x</code> (paifu group) tiles will give you this at the moment (version 1.1). The purpose of this aggressive output is to avoid use of codes which may in future have some other meaning.
== Potential new features ==
You are always welcome to make suggestions for what could be added.
* Implement some neat way of displaying score sticks.
== ChangeLog ==
==== 1.1 ====
* <code>89z</code> changed to whitespace and question mark tiles respectively.
* <code>"</code> flag changed from west-pointing sideways tiles to east-pointing stacked tiles (for kan groups).
* <code>z</code> descriptor added, principally for [[paifu]]. Only the unflagged tiles have been given assignments. The remainder output a reserved tile image to warn editors if used mistakenly.
* Parser now adds the <code>baseline</code> argument to the image code, for aesthetic qualities when formatting [[mentsu]].
** It would be nice to scan the wiki (automatically?) and update any previous cases where the sideways tiles were formatted in a centered position. This is necessary because updates to the extension do not automatically materialise in existing pages - they must be edited for changes to take effect.
==== 1 ====
Initial version.


== Full list of tile images available ==
== Full list of tile images available ==
Line 173: Line 213:


{{#mjt: 0123456789z}}
{{#mjt: 0123456789z}}
{{#mjt: 0123456789x}}


{{#mjt: 0123456789m'}}
{{#mjt: 0123456789m'}}
Line 189: Line 231:


{{#mjt: 0123456789z"}}
{{#mjt: 0123456789z"}}
{{#mjt: 0123456789x'}}
{{#mjt: 0123456789x"}}

Navigation menu