I just spent the past 4 days figuring out the basics of MXP in conjunction
to getting it running with the LDMud driver.
There is very little documentation out there for this so I thought I would
post what I had to do in order to get it working here where the largest
amount of MXP information is available.
I used the 3.3.712 driver version available at
http://www.bearnip.com/lars/proj/ldmud.html
For the lib I went basic with the 2.4.5 base provided with the driver. but
this should work for any lib with little modification.
Most of the info you need is buried in the docs for the driver, but I'll
still go through the entire process here.
To start with I untarred and compiled the driver without incident on my
slackware machine.
in /obj/master.c I added a hook to the driver to send all telnet negotiations
directly to the mudlib and included /sys/telnet.h which has all the defines
to handle the negotiations.
This sends all negotiations to the function telnet_neg I defined in living.c
This could also be done in player.c I guess but the docs suggested here
first so thats where I put it. :)
Somewhere in living.c
In player.c we need to send an IAC,WILL,TELOPT_MXP using binary_message to
start the negotiation. The docs recommend sending it just before cat'ing
the welcome screen. I expect you could do it anywhere in the login seqeunce
though.. say in move_player_to_start3() if you felt like it.
Thats it for the basics of getting MXP to start (with Mushclient.) if you set
Mushclient MXP debug level to 'the lot' you should see the debug window pop
open on connecting and logging into the mud with a 'I 10007: ( 1776) MXP turned on.'
Lastly, you'll need to set up the ESC codes for MXP. I just put them in my
ansi.h as the ESC character is already defined there. This doesnt come
with the lib so you'll have to find one for yourself and add to it. modifying
Nick's set up a bit we get:
Fini. :)
Now I'm off to set up a workable server to handle ANSI/MXP after I read a little
more on the proper implementation of MXP. :)
~Ettercap
to getting it running with the LDMud driver.
There is very little documentation out there for this so I thought I would
post what I had to do in order to get it working here where the largest
amount of MXP information is available.
I used the 3.3.712 driver version available at
http://www.bearnip.com/lars/proj/ldmud.html
For the lib I went basic with the 2.4.5 base provided with the driver. but
this should work for any lib with little modification.
Most of the info you need is buried in the docs for the driver, but I'll
still go through the entire process here.
To start with I untarred and compiled the driver without incident on my
slackware machine.
in /obj/master.c I added a hook to the driver to send all telnet negotiations
directly to the mudlib and included /sys/telnet.h which has all the defines
to handle the negotiations.
#include "/sys/telnet.h"
...
...
void inaugurate_master (int arg)
{
...
...
set_driver_hook(H_TELNET_NEG, "telnet_neg");
}
This sends all negotiations to the function telnet_neg I defined in living.c
This could also be done in player.c I guess but the docs suggested here
first so thats where I put it. :)
Somewhere in living.c
#include "/sys/telnet./h"
...
...
void telnet_neg( int action, int option, mixed *sb) {
switch(option) {
case TELOPT_MXP:
{
switch(action) {
case DO:
{
// here you would probably want to set up a variable
// in the player object for in game functionality.
binary_message( ({ IAC,SB,TELOPT_MXP,IAC,SE }), 3);
// this has to be sent as a direct response to the
// clients <IAC><DO><TELOPT_MXP>
break;
}
case WONT:
{
// here you would probably want to set up a variable
// in the player object for in game functionality.
break;
}
// you can also define cases SB, WILL and DONT if needed.
// if you dont know much about telnet negotiations google it.
default:
break;
}
break;
}
// add other negotiation options here the same way.
default:
break;
}
}
In player.c we need to send an IAC,WILL,TELOPT_MXP using binary_message to
start the negotiation. The docs recommend sending it just before cat'ing
the welcome screen. I expect you could do it anywhere in the login seqeunce
though.. say in move_player_to_start3() if you felt like it.
#include "/sys/telnet.h"
...
...
static int logon() {
binary_message( ({ IAC, WILL, TELOPT_MXP }), 3);
cat("/WELCOME");
...
...
}
Thats it for the basics of getting MXP to start (with Mushclient.) if you set
Mushclient MXP debug level to 'the lot' you should see the debug window pop
open on connecting and logging into the mud with a 'I 10007: ( 1776) MXP turned on.'
Lastly, you'll need to set up the ESC codes for MXP. I just put them in my
ansi.h as the ESC character is already defined there. This doesnt come
with the lib so you'll have to find one for yourself and add to it. modifying
Nick's set up a bit we get:
#define MXP_BEG ESC+"[1z" // ESC should already be defined
#define MXP_END ESC+"[0z"
#define MXPTAG(arg) MXP_BEG arg MXP_END
Fini. :)
Now I'm off to set up a workable server to handle ANSI/MXP after I read a little
more on the proper implementation of MXP. :)
~Ettercap