The Mud eXtension Protocol (MXP) is used to add special effects to the text sent from the MUD. Comparing a MUD with MXP output to a normal MUD is much like comparing a web page to a text page. On a web page you can have colors, different fonts, bold, italic, graphics etc. MXP adds similar commands to the MUD output, and even looks very similar to the HTML or XML language that is used for web pages.
However, MXP is not just something the MUD server can implement. You can use MXP commands in your own scripts to enhance the text displayed in your MUD window.
For MUD coders and implementors interested in the details on the MXP specification, go to the www.zuggsoft.com web site and you will find the latest version of the spec in the Support Library. Here, we are just going to document the most common features of MXP that a zMUD user might use within triggers or scripts.
MXP commands are grouped into two categories: Open and Secure. Open commands can appear on any line on the screen without restriction. To use Open MXP commands on the zMUD command line, make sure the "Expand MXP tags in command line" option is turned on in your MXP Preferences page.
Secure MXP commands can only be executed on lines from the MUD (or from your script) that are "tagged" as secure. The MXP spec instructs the MUD coders how to tag lines as "secure" when being sent from the MUD. To output text to your screen from a script in secure mode, use the #MXP command described below, or place your MXP commands in a #SUBSTITUTE command within a trigger. Examples of this are given below.
Here is a list of Open MXP commands that you can use without restriction:
Secure MXP commands allow more that just visual effects. Secure MXP commands can perform almost any operation in zMUD, including creating triggers, aliases, etc. Since you can already do much of this from a script already, you probably won't use MXP for this. However, since the MUD Server can send secure MXP commands, these features allow the MUD server to create and run it's own scripts on your system. MXP contains a lot of security, and not every zMUD command can be executed by an MXP script. Only "safe" commands can be executed remotely by the MUD server using MXP. For example, the MUD server cannot use the #FILE or #READ/#WRITE commands to access your hard disk. MUD Servers cannot access plugins or use COM scripting. Basically, any command that would give the MUD access to your computer system is not allowed within MXP. Even if the MUD server creates an alias, that alias is tagged as an MXP alias and is still restricted in the commands it can execute.
The MXP specification contains a full list of Secure MXP commands, including commands that allow you to define your own MXP commands. However, here we will focus just on the commands that are useful to a zMUD user in their scripts.
As with Open MXP commands, each secure command is a toggle that must be turned off using the </command> syntax. Unlike Open commands, Secure MXP commands are NOT automatically closed at the end of a line. So, be sure and close them yourself or you will get unpleasant results.
Both of these MXP commands create "hyperlinks". Like on a web page, clicking on a hyperlink performs an action. With the <a> command, the action is to tell your web browser to load a particular URL. This is much like the #URL command. With the <send> command, the action performed by clicking on the hyperlink is to execute a command line and send it to the MUD. The <send> command can also be used to create a special right-click menu which can contain multiple commands.
There are two ways to use Secure MXP commands from zMUD scripts. The easiest method is the #MXP command. The #MXP command works just like the #SHOW command, except it allows for Secure MXP commands. Also, the < character is already escaped, so you don't need the ~ in front of it.
For example, to create a standard web hyperlink, you could do:
By default, the text "hyperlink" will be underlined (this can be turned off in the MXP Preferences). If you move the mouse over the underlined "hyperlink" the mouse hint "http://www.zuggsoft.com/" will be displayed. If you click on the hyperlink, your web browser will open the page www.zuggsoft.com. You can change the mouse hint using the second argument to the <a> command:
In this case, when you move the mouse over the link, the help text "Zugg Software" will be displayed.
The URL can be anything that your browser understands, including mailto: for sending email.
The <send> command also creates a hyperlink, but instead of calling your web browser, it just sends a command back to the MUD. So, for example, the command:
will underline the text "test" by default as a hyperlink. If you move the mouse over the "test" hyperlink, the mouse hint will show "test". If you click on the hyperlink, the command "test" is sent to the MUD. This works just as if "test" was entered on the command line, so if you have an alias called "test", it will be executed.
To change the command sent to the MUD, use the first argument of the <send> command. So, the command:
will create a hyperlink called "test", but now, when you click on it, the command "hello" is sent to the MUD instead.
To change the help text displayed when the mouse is over the link, use the second argument to the <send> command. So:
will still send the "hello" command when you click on the link, but now the mouse-over help will say "help me"
The most powerful form of the <send> command will create a right-click menu of multiple commands. This is done by using a string list for the commands and for the help text. The first command in the list will still be sent if you just left-click the link. But if you right-click the link, the other commands will be shown, and the other items in the string list for the help argument will be used as the menu captions. So, for example:
will create a hyperlink called "test". If you move the mouse over it, the "help me" text will be displayed. If you left-click on the hyperlink, the command "hello" is sent to the MUD. However, if you right-click on the hyperlink, you will get a popup menu with 3 commands listed. The first item will say "help me" and will send "hello" to the MUD when you select it. This is the same as left-clicking on the hyperlink. The second item in the menu will say "First command" and will send "command1" to the MUD when you select it. The third item in the menu will say "Second command" and will send "command2" to the MUD when you select it.
Here is a more practical example that a MUD might use if you are in a store trying to buy an item:
The text "bread" will be underlined as a hyperlink. If you move the mouse over "bread", the "buy" help text will be displayed. If you click on the hyperlink, the command "buy bread" is sent to the MUD. However, if you right-click the hyperlink you are given the options to "examine" the bread, or "steal" the bread. This allows the MUD to provide a lot of command options hidden within the normal text of the MUD.
Instead of using the #MXP command to send Secure MXP commands to the screen, you can also create a trigger and then use the #SUBSTITUTE command to add MXP commands to the text. For example,
will replace the word "north" whenever it is displayed by the MUD and replace it with the text <send>north</send> which creates a hyperlink. If you click on the "north" hyperlink, the command "north" is sent to the MUD.