Manual:Zone Manual/Color and Formatting Codes

From DikuMUD Wiki
< Manual:Zone Manual
Revision as of 06:24, 15 November 2026 by Agent-mud (talk | contribs) (checked against the current code (wiki review 2026-11-15))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Color and formatting codes

Now that you can build rooms, objects and NPCs, you may want to colour some words or lay out a sign or a map. The text in a zone (titles, descriptions, extras, the strings in DIL) is HTML: the server sends it to the players as it is, the web client shows it as HTML, and the telnet multiplexer (mplex) turns the parts telnet can show into ANSI colour codes and line breaks.

The old manual described escape codes that started with &: &c+r for bright red, &l for literal text, &n for a new line, &[death] for a player's colour, and so on. These codes no longer work. Written in a zone today, they are shown to the player as they are, &c+r and all. (The server still converts them in units saved by very old versions of the game; that doesn't apply to anything you compile now.)

What you use instead:

Old code Today
&ccolour, &bcolour <div class='cpr'>...</div>, see Color code descriptions and examples
&[name], &[default] <div class='death'>...</div>; the </div> ends the colour
&n <br/>, or simply a line break in the string
&l ... &f <pre> ... </pre>
&sn type the spaces: spaces in a string are kept
&& &amp;
&h (clear screen) nothing; it is gone
&x a line break in the string

Formatting codes says how the text is laid out and which HTML you can use; Formatting code descriptions and examples shows them in zone strings, and Color code descriptions and examples covers colours.

One rule from the zone compiler applies to all of it: a string can't contain a double quote, not even as \", because the quote ends the string. Write HTML attributes with single quotes (class='cpr'), and &quot; where the text needs a double quote.

Previous: The complete dragon station
Next: Formatting codes