Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Message
| Bast is correct, Aardwolf used telnet codes for some things, and a "statmon" command for others.
MXP could also be used.
I personally prefer the {stats} line for a few reasons...
- It is simple for the server to implement - no telnet codes needed (nor the worry about whether the client will support them).
- Implementing MXP is non-trivial, as you need to worry about "escaping" the use of < > and & everywhere text is sent to the MUD.
An example of what Aardwolf did with the {stats} line was:
{stats}39/30,16/13,13/13,28/25,29/25,13/10,93,100,100,44,34,You are Standing.,9999,532/567,510/510,880/880,3199,0,0,2500,241,25,5
1="39/30" --> current str / base str,
2="16/13" --> current int / base int,
3="13/13" --> current wis / base wis,
4="28/25" --> current dex / base dex,
5="29/25" --> current con / base con,
6="13/10" --> current luck / base luck,
7="93" --> hp percent,
8="100" --> mana percent,
9="100" --> moves percent,
10="44" --> hitroll,
11="34" --> damroll,
12="You are Standing." --> position,
13="9999" --> enemy pct (9999 if not fighting),
14="532/567" --> hp / maxhp,
15="510/510" --> mana / max mana,
16="880/880" --> moves / max moves,
17="3199" --> gold,
18="0" --> qp,
19="0" --> tp,
20="2500" --> align,
21="241" --> exp to level,
22="25 --> current level
23="5" --> position
(This was a single line).
Now a simple trigger, matching: {stats}*
... would capture this (and omit from output of course). Then a simple string.match could break the line up into its component parts.
I think next time I would use key/value pairs, which is more flexible for future expansion. eg.
{stats}str="39/30",int="16/13",wis="13/13" ... etc.
Then Lasher built into the MUD a command ("statmon on" I think) which turned on this display. Any client that wanted to use it would then just send "statmon on" and away it went.
A similar thing was done for the current room name, where you are on the overland map, and so on.
The only real problem we had with this was getting started - for example, for the client to make sure "statmon" status was on, it had to send "statmon on", however the client couldn't really be sure it was at "command prompt" level in the MUD. For example, the MUD might have made a MOTD announcement, and be showing "Press <return> when read.". Now if this was the moment the client sent "statmon on" then it wouldn't "take".
To work around this we used telnet codes, simply as toggles for the various extra information types.
This meant sending a telnet negotiation sequence like:
IAC, SB, AARDWOLF_TELOPT, which, TELOPT_ON, IAC, SE
(where AARDWOLF_TELOPT was 102, TELOPT_ON was 1, and which was 1 for statmon).
Now the server would catch this at a lower level than the command level, so it would always work, and set a flag appropriately for that player's descriptor.
As for MXP, it could be done that way, but adding MXP to the server is non-trivial. I did a page about that:
http://www.gammon.com.au/mushclient/addingservermxp.htm
You need to be careful, or you will be forever plagued by stray < and > characters in room descriptions, pages etc. which disappear from view depending on which client the players are using (and not all clients support MXP).
Also, MXP is really a mark-up language for MUD output (and it works fairly well for that), but isn't really designed for sending out-of-band data which isn't displayed. What I mean by that is, if you are receiving your current HP, MXP can colour it red, and make it a hyperlink by marking it up like HTML does. But to simply send data to the client, which isn't initially viewed, you really need to set up MXP variables with "entity" statements, which is a bit fiddly.
The plugins I wrote for Aardwolf, which parse the {stats} line, and display player status in various nice windows are all available from this site, if you want to look at them as a basis for your own design.
http://www.gammon.com.au/mushclient/plugins/Aardwolf/ |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|