Introduction to Macros

One of the first ways to make zMUD do more than just a dumb TELNET client is to assign commands to keys on your keyboard.

To assign a command to a key, press Control-K, or select Define Key from the Action menu. You will be prompted to press the key combination that you wish to assign a command to. Almost any key on the keyboard can be assigned a command, in combination with the Shift, ALT, and Ctrl keys. If you assign the macro to a key already used by zMUD (like Ctrl-C for Copy), then your macro will override the zMUD command, so be careful about this. You can control whether your macros override Windows commands (like Alt-F) in your Command Line Preferences. Also, note that zMUD automatically activates the NUMLOCK mode to allow you to assign macros to the keypad. If NUMLOCK is off, the keypad functions as the cursor keys. Since the cursor keys are used to edit the command buffer and recall from the command history, you should refrain from assigning macros to the arrow keys (although you can if you want).


Once you press the key you want to assign a command to (for example, the NUM8 key, the 8 key on the keypad) you will be prompted for the command. Enter the text you wish to be sent to the MUD when you press this key. For example, if you were assigning a command to the NUM8 key, you could enter the text north. Now, when you press the NUM8 key, the text north is sent to the MUD. Notice that when you press a macro key the text in the command entry field is selected, but is otherwise undisturbed. This is a very useful feature. For example, if there is a monster to the north that you want to hit quickly before it can hit you, you can enter kill monster in the command entry field, press the NUM8 key (to move north) quickly followed by pressing <Enter> to send the kill command to the MUD.

Macro Chaining

If you want the text assigned to the macro key to be placed into the command line instead of being sent to the MUD, turn off the "Send to MUD" option in the Macro settings screen. To append the text of the macro key to the current contents of the command line, turn on the "Append to Command Line" option. Text will only be appended if the command line is not fully highlighted.

If you turn on the Daisy Chain option, then this macro can be used after other macro keys for a special effect called "Macro Chaining". When Daisy Chain is enabled, the macro text is appended to the command line if the command line ends in a space character. Then the whole command line is sent to the MUD. Otherwise, if the command line doesn't end in a space, the macro command is sent to the MUD normally.

The best way to understand how macro chaining works is to look at an example:

Define a macro key with the string "open " and turn off the "Send to MUD" option, but turn on the "Append" option. If you assigned this to the F8 key, then pressing F8 would put the text "open " in the command line (without sending it to the MUD).

Next, define a macro with a command of "north" and turn on the Daisy Chain option. Assign this macro to the NUM8 key on the keypad (actually, zMUD defines this macro for the number pad key automatically, and assigns directions like north, south, east, west to all of the keys on the number pad).

Now, when you press F8, the text "open " is placed in the command line. Now when you press NUM8, the command "north" is appended to the command line (since it ends with a space) and the command "open north" is sent to the MUD. However, if you just press NUM8 by itself with nothing on the command line, then the command "north" is just sent to the MUD.

Contents User Interface Overview Introduction to Aliases