Manual:Zone Manual/Color and Formatting Codes/Color code descriptions and examples

From DikuMUD Wiki
Jump to navigation Jump to search

Color code descriptions and examples

&c and &b
In order to allow you to change the colors there are two codes. One is for the foreground color (&c) and the other is for the background color (&b). '&c' is used with one or two arguments depending on brightness, while the '&b' s only used with one because it has only one brightness. They both have the forms as follows:
	&c<bright><color>
	&b<color>

It is important to set both the foreground and background color because if a player has his default background color set to blue and you use blue as a foreground color it will make the letters invisible to the player. It is also important to set the colors back to the default color when done. this is done by using the following command:

	&[default]

The '&[default]' command will be described in the next section. It is enough to know for now that it will return the players colors to their default colors.

Before we give some color examples we should now define the symbols for brightness and the symbols for each color and what they are.

Colors
Code Color
n Black
r Red
g Green
y Yellow
b Blue
m Magenta
c Cyan
w White
Sample Color codes
Code Resulting Colors
&cb&bw Example
&c+g&bn Example
&c+w&br Example
&c+w&bn Example
&[<color>]

As we have said in the previous section if you are not careful you can make your text not visible by the player by setting the foreground to the same color as the background. In order to make it possible for you to easily change how the color looks and to even match it with the way players have their colors set already we have created colors that the players can set. and you can use. The VME comes with a default list of colors which can be added to by either the color.def or even by a DIL program on line. The default colors are as follows:

death default exit
group hit_me hit_opponent
hit_other immort_descr immort_title
log miss_me miss_opponent
miss_other nodam_me nodam_opponent
nodam_other npc_descr npc_title
obj_descr obj_title pc_descr
pc_title prompt respond
room_descr broom_title say_other
say_self shield_me shield_opponent
shield_other shout_other shout_self
social_other social_self spells
tell_other tell_self time
weather whisper who
who_guild who_inv who_name
who_title wiz xpgain

To use these colors all you have to do is use the following formatting command:

	&[color]

The color that will be shown is the color that the player has set for the color in question. If for example the player has his or her 'death' color set to bright red with a black background and you have a description as follows:

	descr
	"This is a &[death]death&[room_descr]room"

The description would be in the players 'room_descr' color while the word death would be in his or hers 'death' color. You should note we had to set the color back to the room description color so that the rest of the description was not in the 'death' color.

To change the players color to the default out put color which is the color that is used when no color is specified by the server then you use 'default'. You probably won't use this in normal zone building but it is very important to know it exists when you start making spells, skills, and commands with DIL

Previous: Formatting code descriptions and examples
Next: The DIL Section