| 1 |
|
| 2 |
** Media tags ** |
| 3 |
|
| 4 |
Foreword |
| 5 |
======== |
| 6 |
|
| 7 |
This document is a quick explanation of tags that can be used in extended |
| 8 |
messages. For informations on what extended messages are at protocol level, |
| 9 |
please refer to the protocol file in doc/Developers/protocol |
| 10 |
|
| 11 |
Quick example |
| 12 |
============= |
| 13 |
[b]And now, for your pleasure only, an example[/b] |
| 14 |
|
| 15 |
[i]This is an old letter, full of dirt and partially destroyed |
| 16 |
[hand]My dear friend,[/i] |
| 17 |
as you know, two years ago, i had to leave quickly. |
| 18 |
Words have come to me of powerful magic scrolls discovered in an old temple by |
| 19 |
my uncle. I have moved to study them. I have, however, not forgot your knowledge |
| 20 |
in ancient languages. I need your help for |
| 21 |
[print][b]Some parts of document are to damaged to be readable[/b] |
| 22 |
[arcane]Arghis [color=Red]k'h [color=dark slate blue]ark |
| 23 |
[color=#004000]fido[/color] |
| 24 |
[hand]please come as fast as possible my friend. |
| 25 |
[print][b]The bottom of letter seems deliberatly shredded. |
| 26 |
|
| 27 |
What is it? |
| 28 |
=========== |
| 29 |
Media tag are special mark up that are send with extended text. Situation in |
| 30 |
which such case happend are, but not limited to, book reading, signs reading, |
| 31 |
motd, news, rules. Media tags are made of delimiters, with inside them the |
| 32 |
name of tag and optional parameters for the tag. Unlike html or bbcode, there |
| 33 |
is no notion of opening and closing tag. A client not able to understand a tag |
| 34 |
is supposed to ignore it. Also, when server is communicating with and old |
| 35 |
client that does not understand a a specific extended text, it will issue a |
| 36 |
classical message output, with all tags removed. |
| 37 |
|
| 38 |
Don't be confused by the name of some tags. The fact there exist a pair [b] |
| 39 |
[/b] does not mean there is an opening and a closing 'bold' tag. It simply |
| 40 |
mean there is a 'bold' and a 'no bold' tag. You might think it's the same, but |
| 41 |
no. Imagine the following text: |
| 42 |
|
| 43 |
Hello [b] all [b]crossfire[/b] members [/b] |
| 44 |
|
| 45 |
The word 'members' will not appear in bold, because there is no notion of |
| 46 |
closing tags and so no notion of tag inside a tag (in bbcode, it would probably |
| 47 |
appear in bold). This all was made to ensure all client can safetly ignore tags |
| 48 |
they don't understand and make the parsing process straight forward. |
| 49 |
|
| 50 |
Tags are reset on each drawextinfo call. The two blocks of code are not |
| 51 |
equivalant: |
| 52 |
|
| 53 |
draw_ext_info(..., "[b]yadda yadda yadda"); |
| 54 |
draw_ext_info(..., "yeah, whatever"); |
| 55 |
|
| 56 |
vs |
| 57 |
|
| 58 |
draw_ext_info(..., "[b]yadda yadda yadda\nyeah, whatever") |
| 59 |
|
| 60 |
In the first case, only yadda.. is in bold, because all tags get reset on the |
| 61 |
next draw_ext_info. In the second case, since it is all in one draw_ext_info, |
| 62 |
everything is bold. |
| 63 |
|
| 64 |
How does it work? |
| 65 |
================= |
| 66 |
All tags start with character '[' and ends with character ']'. Between those is |
| 67 |
the tag itself, made of the name and optionally the arguments. There is no rule |
| 68 |
as how the arguments are to be handled. This all depends on the tag. The only |
| 69 |
requirement is that the character ']' and '[' do not appear inside the tag (be |
| 70 |
it in tag name, parameter name or parameters value). The end of line are |
| 71 |
interpreted as is and multiple spaces are not removed. The only thing done is |
| 72 |
intepretation of tags. |
| 73 |
|
| 74 |
Format of a tag: [<tagname><arguments part>] |
| 75 |
|
| 76 |
Existing tags |
| 77 |
============= |
| 78 |
[b] activate the bold flag. |
| 79 |
[/b] deactivate the bold flag |
| 80 |
[i] activate the italic flag |
| 81 |
[/i] deactivate the italic flag |
| 82 |
[ul] start underline of text |
| 83 |
[/ul] end underline of text |
| 84 |
[fixed] set the font to fixed width |
| 85 |
[arcane] set the font to a magical one (old english, etc - readable, |
| 86 |
but old looking) |
| 87 |
[hand] set the font to hand writing |
| 88 |
[strange] set the font to 'strange unknown language'. This is a runic |
| 89 |
script and is not comprehensible. As such, any strange |
| 90 |
text should basically be gibberish. If you do something |
| 91 |
like 'the password is [strange]secret', with the idea |
| 92 |
that players will not be able to figure it out, you are |
| 93 |
wrong, because there is no way to ensure that the client |
| 94 |
will not just print out 'the password is secret'. Instead, |
| 95 |
you should randomize the characters, eg, |
| 96 |
'the password is [strange]terdsfa' - if the player has |
| 97 |
a proper font installed, these will appear as strange |
| 98 |
runic characters. |
| 99 |
Another use could be something like: |
| 100 |
'The scroll says [strange]undecipherable text' - if |
| 101 |
client has a normal font, they will see the undecipherable |
| 102 |
text. If they have a proper font installed, they will |
| 103 |
see strange runic symbols. |
| 104 |
[print] set the font to the client default one |
| 105 |
[color=<value>] activate color and set it to <value> (see color section bottom) |
| 106 |
[/color] deactivate color |
| 107 |
|
| 108 |
Colors |
| 109 |
====== |
| 110 |
Colors are handled the way XParseColor handle them. This process is quite |
| 111 |
complex. It is suggested you always use standard color names, ideally |
| 112 |
restricting yourself to standard crossfire color names, eg |
| 113 |
|
| 114 |
[color=Red], [color=DodgerBlue] [color=DarkSeaGreen] |
| 115 |
|
| 116 |
Other formats can be used but are discouraged: |
| 117 |
use the html like #RRGGBB (eg [color=#FF0000], [color=#0000FF], |
| 118 |
[color=#004000]) |
| 119 |
use the X11 rgb string rgb:rr/gg/bb (eg [color=rgb:ff/00/00], |
| 120 |
[color=rgb:00/00/ff], [color=rgb:00/40/00]) |
| 121 |
|
| 122 |
The use of color names is highly suggested because they client can parse and |
| 123 |
override the color names as needed for the style in use. |
| 124 |
|
| 125 |
For example, if the client has a white background (by default), and you have |
| 126 |
a tag like '[color=#ffffff]', that will result in invisible text. |
| 127 |
|
| 128 |
However, if the color is instead '[color=white]', the styles for the gtk2 |
| 129 |
client can be set to draw white text as black, and thus still be readable. |
| 130 |
This style adjustment is much harder when using rgb type values. |
| 131 |
|
| 132 |
It is also suggested the changes of color be used sparingly. If you really |
| 133 |
want to draw attention to a word, it is suggested you use the underline |
| 134 |
tag, [ul], as in no other case would that be drawn. Italics and bold |
| 135 |
may be used for actual font descriptions (white text on white background |
| 136 |
may instead by drawn as bold black text on white background to |
| 137 |
distingiush from normal black text). Likewise, it is possible that some |
| 138 |
of the fonts the player uses may be italic fonts (handwriting being |
| 139 |
a likely case), and applying an italic style to an already italicized |
| 140 |
font has no effect. |