Text Formatting

Text formatting codes can be used in absolutely anything that outputs text - object descriptions, text blocks, msg text, etc.

To add formatting to text, insert the pipe character "|" followed by the relevant formatting code:

CodeText formatting
|bbold on
|xbbold off
|uunderline
|xuunderline off
|iitalic
|xiitalic off
|cbblack, or current foreground colour
|crred
|clblue
|cyyellow
|cggreen
|sxxchange font size to xx - anything from 01 to 99
|s00revert to default font size
|jlset text to left-justified
|jcset text to centered
|jrset text to right-justified
|nnew line
|xn(at end of msg text only) no new line
|wwait for keypress
|cclear screen

The |cb formatting code usually stands for Black, but the foreground colour may be changed (by the foreground tag in the game definition block, or by the foreground script command) - so this code in fact corresponds to the current foreground colour. By default this is black, and some players may have their options set so this is always black.

Here's an example:

msg <|b|crSTOP!|cb|xb There is a |ireally|xi big, |cggreen|cb thing here.>

This displays:

STOP! There is a really big, green thing here.

The |xn code is a special case and can only be used at the end of a line of text displayed with the msg command. This will mean that the next text displayed will appear on the same line, and is useful if you want to conditionally print something. For example:

msg <You have |xn>
if ( %gold% >= 5 ) then {
	msg <over five pieces of gold, and you may enter.>
	goto <party> }
else msg <not got enough gold. Go away.>

Default fontsize is dependent on user settings and the contents of default fontsize in the game definition block.

When specifying formatting for a line, don't forget to turn it off! If you don't, all subsequent text, even Quest's error messages such as "Unrecognised command", will be displayed with the formatting specified. The only formatting codes that do not need to be turned off are |n, |xn, |w and |c. To "turn off" colours, use |cb to change the text back to the default foreground colour.

Note that you can only use one justification tag per line - if you use "|jcWelcome to my Game|jl", the "Welcome to my Game" text will be printed left-justified rather than centred. Instead, you should use "|jcWelcome to my Game" on one line, and "|jl" on the next. If you have no further text to print, use "|jl|xn" to change the justification without printing a new line.

|w and |c are useful when displaying large amounts of text in a text block. |w will wait for a keypress (note that no message is printed, unlike with the wait script command - you should add "Press a key to continue..." etc. yourself to the text section before the |w code), and |c will clear the screen (useful after the |w code).

Don't be dependent on font type, size or colour for anything - ASCII art, for example, is doomed to failure as the Quest window size can be changed by the player, and font size, type and colour commands can be set up to be ignored from the player's options.

 

< Back