MCP Implementation in zMUD

The MUD Client Protocol (MCP) is designed to facilitate communication between the MUD server and MUD client.  "Out of band" messages can be sent to control server and client behavior.

For details on MCP, see the official MCP specification at http://www.moo.mud.org/mcp/

This document describes technical details of the zMUD MCP Implementation that was added in zMUD version 6.50.

Standard Packages

zMUD supports the following packages:

mcp (without the optional cords)
The basic MCP 2.1 protocol is implemented.  See http://www.moo.mud.org/mcp/
mcp-negotiate
The required negotiate package.  See http://www.moo.mud.org/mcp/
dns-org-mud-moo-simpleedit
Allows client-side editing of MUD data.  zMUD loads the data sent by the MUD server into the internal zMUD editor.  Clicking the Send button in the zMUD editor will send the edited text back to the server via MCP.  See http://www.awns.com/mcp/packages/README.dns-org-mud-moo-simpleedit and http://www.moo.mud.org/mcp/simpleedit.html
dns-com-awns-displayurl
Allows the MUD to send a URL to be displayed by the client's web browser.  See http://www.awns.com/mcp/packages/README.dns-com-awns-displayurl
dns-com-awns-ping
Allows the server to determine the lag between the client and server.  See http://www.awns.com/mcp/packages/README.dns-com-awns-ping
dns-com-vmoo-client
Allows the server to determine the version of client software being used, and to determine the client screen size.  See http://www.vmoo.com/support/moo/mcp-specs/#vm-client
dns-com-zuggsoft-mxp
Send an MXP command to the client.  See below for spec.
dns-com-zuggsoft-msp
Send an MSP command to the client.  See below for spec.

MCP Scripting

To aid in advanced scripting, you can query the data sent in an MCP command using the %mcp function.  Specify the MCP command you are interested in, the the %mcp(command) function will return a database variable containing the fields and data last sent by the MUD for that command.  For example, if the MUD sends an MCP dns-org-mud-moo-simpleedit-content command in order to locally edit a file, you could then use the zMUD command: #SHOWDB %mcp("dns-org-mud-moo-simpleedit-content") to display data similar to the following:

reference: #72.name
name: Joe's name
type: string
content: Joe

As a special case, the package name "mcp-negotiate" can be used in place of the MCP command to query the list of packages supported by the current server.  The result is a database variable with the Key field called "list" and the value which is the list of packages.  So, for example, #SHOWDB %mxp("mcp-negotiate") might display:

list: mcp-negotiate|dns-org-mud-moo-simpleedit|dns-com-awns-ping

You can also create Triggers for MCP commands.  In the Trigger editor, click New and in the Advanced Options, change the trigger type to: MCP.  MCP Triggers are forced to match at the beginning of the MCP command string.  The entire MCP command string is sent to the trigger, with the authentication string information removed for security purposes.  

The trigger will fire when all data for the command has been received and the MCP command has been executed.  The %0 variable will contain the full database variable with the data sent by the MUD.

So, for example, if you triggered on the MCP dns-org-mud-moo-simpleedit-content command shown above, you would put "dns-org-mud-moo-simpleedit-content" into the pattern field for your trigger, and in the action field, %db(%0,"name") would return "Joe's name", and %db(%0,"content") would return "Joe", etc.

You cannot change the data of an MCP command in a trigger.  You can only respond to the command and take action.

dns-com-zuggsoft-mxp package

This MCP package allows you to send an MXP command using the MCP out-of-band messages.  This makes it easier for MUDs that already implement MCP to utilize MXP.  See http://www.zuggsoft.com/zmud/mxp.htm for the current MXP specification.

The syntax of the dns-com-zuggsoft-mxp package is:

dns-com-zuggsoft-mxp(mode, lines*)

where "mode" is the numeric MXP mode you want the "lines" parsed.  For example, Secure mode is 1, Open Mode is 0.  Here is an example of sending an MXP <IMAGE> command via MCP:

#$#dns-com-zuggsoft-mxp auth-key mode: 1 lines*: "" _data-tag: 1234
#$#* 1234 lines: <IMAGE filename.gif align=bottom>
#$#: 1234

dns-com-zuggsoft-msp package

This MXP package allows you to send MSP commands using the MCP out-of-band messages.  This makes it easier for MUDs that already implement MCP to utilize MSP.  See http://www.zuggsoft.com/zmud/msp.htm for the current MSP specification.

Two MCP commands are defined for this package:

dns-com-zuggsoft-msp-sound( name, v, l, p, t, u)

Will play the given sound effect file on the client.  This is the same as using the MSP command: !!SOUND( name V=v L=l P=p T=t U=u)

'v' is the volume, from 0 to 100.  'l' is the looping control and indicates the number of times to play the sound.  'p' is the sound priority, which defaults to 50.  't' is the class type for the sound.  'u' is the base URL to use to download the sound remotely if it is not already present on the players system.

dns-com-zuggsoft-msp-music( name, v, l, c, t, u)

Will play the given MID music file in the background on the client.  With the zMUD implementation of MSP, ANY music file that the player has a Windows MCI driver for is supported.  For example, "name" could represent an AVI movie file and this would cause the movie to be displayed for the player.  This MCP command corresponds to the MSP command: !!MUSIC( name V=v L=l C=c T=t U=u)

'v' is the volume, from 0 to 100.  'l' is the number of times to play, or -1 to indicate continuous looping.  'c' specifies whether the music should be continued if already playing, or reset to start again.  't' is the class type for the sound.  'u' is the base URL to use to download the music file if not already present on the players system.