Color Syntax

This Preferences page contains options that control conversion of ANSI color to MUD color commands. Most of these preferences are local to the current character.

Color_Sy.jpg

These options control how color commands are sent to the MUD, rather than how ANSI color commands are received. Most MUDs do not allow you to send the raw ANSI escape codes to the MUD, but instead implement a syntax for specifying colors. When using the zMUD editor to set the color of text, you can use the color syntax specified on this page to convert from the ANSI color codes used by the editor to the syntax needed by the MUD. This syntax also effects how lines that use the %ansi function send the color information to the MUD.

First, each color is assigned a keyword, usually a single letter. All 16 foreground colors and 8 background colors are shown and you enter the keyword that the MUD uses to refer to the color in the box provided. For example, if your MUD uses r for dim red and R for bright red, enter r into the box next to the dim red color and R into the box next to the bright red box. You'd probably also enter r into the red background box also.

Next, the MUD usually has a way to represent the foreground and background colors. For example, if the MUD uses %r for foreground red and &r for background red, enter %F into the "Syntax for foreground" box and &B into the "Syntax for background" box. Some MUDs also have a command to set both colors at once, which you would enter into the "Syntax for setting both" box. In this example, you would enter %F&B to set both colors. Finally, enter any command that the MUD uses to reset color back to the default value in the "Syntax for reset" box.

You can also globally enable or disable the color syntax using the option on this page. The zMUD editor has its own option for using color syntax which you must also turn on to convert ANSI colors to color syntax commands using the editor.

Using Color Syntax

Color syntax can be used from different places in zMUD. First, in the Editor, turn on Color Syntax in the Options menu, and turn on ANSI and turn off Parsing. Then type some text and use the color button to change parts of it to different colors. When you have the text the way you want it, click the Send button to send it to the MUD. The proper color syntax text will be inserted so that your text on the MUD is received with the proper colors.

From the main MUD window, Color Syntax is controlled by the Color Syntax Preferences page. Enable color syntax on that page. Then you can use the %ansi function to color the text you send to the MUD. For example:

[%ansi(red)]this is red [%ansi(green)]this is green

will send red and green text to the MUD. The brackets [] are needed to expand the result of the %ansi function within the command line. If you have the Expand Vars option turned on in your Preferences, then you don't need the brackets.

If color syntax is enabled, ANSI codes will also be expanded whenever you paste text into the main command line in zMUD. Go back to the Editor and Copy the colored text that you created. Then go to the main command line and Paste (Ctrl-V) the text into the command line and you will see the correct color syntax codes added. Then just press Enter to send the colored text to the MUD.



Contents Background Reconnection