|
Ghorin Newbie
Joined: 15 Mar 2010 Posts: 5
|
Posted: Mon Mar 15, 2010 8:14 pm
Inconsistent MXP <BR> tag behaviour in ZMUD vs CMUD |
Hello,
I'm currently implementing MXP support for my MUD and I've noticed a problem with the way a <BR> MXP tag is handled in CMUD. Namely, it seems to "close" all open MXP tags just like a regular newline would do; this does not happen on ZMUD.
Example:
The following sequence sent from the MUD:
Code: |
\e[7z\e[4z<font color=blue>line1\e[4z<br>line2\e[4z</font>\n |
(setting default mode to "locked" and then prefixing each tag with "secure for one tag" mode)
will display both lines in blue in ZMUD, while only one line in blue in CMUD. I've replicated it on both CMUD 2.37 and the recent beta.
Is that an intentional change, or a bug in CMUD? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Mar 15, 2010 9:09 pm |
This is an intentional change. It was a bug in zMUD that it didn't close Open tags, which could allow people to place BR tags within open chat text. The MUD should almost always be sending lines containing MXP in secure mode. Basically, "secure mode" says "this is coming from a MUD that understands MXP", whereas "open mode" was designed for MUDs that didn't support MXP where people could still place some basic MXP commands within open chat text.
In general, zMUD has several MXP bugs like this which were fixed in CMUD to make CMUD more compliant with the MXP spec and with how MXP works in other MUD clients. We are working on clarifying the MXP spec to deal with obscure cases like this. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Mar 15, 2010 9:11 pm |
Btw, if you are implementing MXP on your MUD, you should probably stay away from the "locked" and "secure for one tag" stuff. Just start each line from the MUD that contains MXP with the secure tag. Start any line sent by other users (like chat) with the open tag (or no tag at all).
|
|
|
|
Ghorin Newbie
Joined: 15 Mar 2010 Posts: 5
|
Posted: Mon Mar 15, 2010 9:33 pm |
Hmm, I prefer to use locked mode as the default (rather than open) for two reasons:
- to avoid things like <font size=200> which is an open tag; having users placing that in a chat line is not necessarily good ;)
- people who use non-MXP clients often use the < > symbols in their chat, custom title, etc. as an emphasis; over time we've received numerous "bug" reports that certain parts of chat/who list become "broken/cut". Locked mode effectively prevents that.
But that aside, I'd still want users to configure various MUD "message types" (like chat, descriptions, says, tells, ...) with MXP rather than plain ANSI. Messages can of course contain user text (tells, says), so secure mode is not really appropriate. They can also be multi-line (descriptions), hence the problem with <BR> closing the tags.
Still, thank you for clarification - I'll try something else; it seems that setting "secure" mode (rather than "temp secure") for the <br> can work as well. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 16, 2010 3:41 am |
On a MUD supporting MXP, you are supposed to be filtering user chat and converting < and > to & lt; and & gt; symbols, and then only allowing the tags that you want to allow.
CMUD (and zMUD) already protect users against abuse, like with your "size=200" example. Don't know what other clients do, but CMUD/zMUD specifically prevent anything that would really mess up the screen in open mode.
The problem with using "lock" mode instead of tagging each line is that the client can get out of sync if it misses a single control code. I'd rather see each line start with the proper mode code.
For message types, take a look at the TAG option in MXP or use the line-tags options. CMUD/zMUD gives the user a good interface for line-tags to determine if the channel should be sent to another window, or colored, or gagged, etc.
As far as multiline, the MUD shouldn't normally add line-breaks itself. You should let the client do the wrapping. If you are sending a line break to force something, like a list of items in a room or something, then you should already be in MXP secure mode. Chat lines from the user should always be a single long line to let the client deal with wrapping. Then you don't need BR within user chat. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 16, 2010 3:43 am |
Quote: |
people who use non-MXP clients often use the < > symbols in their chat, custom title, etc. as an emphasis; over time we've received numerous "bug" reports that certain parts of chat/who list become "broken/cut" |
That's actually the main reason why MXP MUDs should always convert the < > symbols into & lt; and & gt; entities. zMUD definitely had bugs with < > characters, but CMUD fixed those bugs. But a lot of people still insist on using zMUD. But if you encode the < > characters then zMUD works fine too. |
|
|
|
Ghorin Newbie
Joined: 15 Mar 2010 Posts: 5
|
Posted: Tue Mar 16, 2010 7:42 pm |
Thanks for your replies,
Yes, actually parsing MXP (< > & replacement, detection of valid user tags) would work too; I might end up doing this eventually, although I didn't want to do it at first for performance reasons - I can only change code on LPC level (rather than the LPMUD driver); doing more advanced string parsing on script level is not too effective.
Quote: |
CMUD (and zMUD) already protect users against abuse, like with your "size=200" example. Don't know what other clients do, but CMUD/zMUD specifically prevent anything that would really mess up the screen in open mode. |
Oops, right, yes it seems that this is prevented in zmud/cmud (mushclient does not support font sizes anyway). Still, that would be one thing to note in the MXP spec if you are working on it ;)
Quote: |
As far as multiline, the MUD shouldn't normally add line-breaks itself. You should let the client do the wrapping. If you are sending a line break to force something, like a list of items in a room or something, then you should already be in MXP secure mode. Chat lines from the user should always be a single long line to let the client deal with wrapping. Then you don't need BR within user chat. |
As for the multi-line messages, our MUD has very strict formatting rules, one of which has all text output wrapped neatly at ~75 columns; I cannot change that with added MXP support. I could still of course tag each line in the multi-line message (both by using the MXP element TAGS or just having all lines re-start the elements), but it has a side effect of resetting regular ANSI codes that could occur within these messages. (that can be worked around as well, but it still hits the performance issue...)
However, re: the ANSI codes, I found yet another issue with CMUD. ZMUD ignored ANSI codes within tags that added color, CMUD no longer does so (and good - I assume this is an intended change), however it seems to not work so well if font face is changed as well:
The following sequence:
Code: |
\e[6z<font arial>word1 word2\nline2</font>\n\e[5zline3\n |
(2 lines in mxp secure mode) would properly produce "word1 word2 line2" in arial font, while line 3 in regular font.
However, when I add an ANSI colorcode in the middle, like this:
Code: |
\e[6z<font arial>word1\e[31mword2\nline2</font>\n\e[5zline3\n |
The font permanently gets changed to Arial until an explicit \e[3z code is sent.
The same would happen if both lines were sent in \e[1z (secure line) mode rather than having secure locked at the beginning.
Ps. Also about the MXP specification; if you are working on modifying it, I think it should specify what is the relation of MXP tags to ANSI codes, ie. which takes precedence, etc. Currently, the 3 most popular Windows clients that support MXP (ZMUD, CMUD, Mushclient) handle that in a different way each... |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 16, 2010 8:24 pm |
Quote: |
ZMUD ignored ANSI codes within tags that added color, CMUD no longer does so (and good - I assume this is an intended change) |
That is correct. This was a bug fix in CMUD. ANSI codes should be allowed within MXP, and I'll reflect that in the updated MXP spec. But zMUD will always have problems with this (and will not be updated).
Quote: |
however it seems to not work so well if font face is changed as well: |
Definitely looks like a bug in CMUD. I'll add this to the bug list.
A bunch of us (client developers, MUD developers, etc) are working on a new site to keep the MXP spec and allow easy community updating. I'll let you know when the site is ready to announce. But I'll make sure to get this issue addressed. In general, ANSI codes within a MXP tags should allow the color to be changed, and the closing MXP tag will restore the color to what it was before the MXP tag was started. ANSI codes outside of MXP tags work as normal. So there really isn't any such thing as a "priority" between ANSI and MXP. Each one just modifies the current color when encountered in the text stream. Except for the bugs in zMUD of course. |
|
|
|
Ghorin Newbie
Joined: 15 Mar 2010 Posts: 5
|
Posted: Tue Mar 16, 2010 8:45 pm |
Quote: |
So there really isn't any such thing as a "priority" between ANSI and MXP. Each one just modifies the current color when encountered in the text stream. Except for the bugs in zMUD of course. |
There is also the issue of foreground vs background (and attributes like italic/underline which can be controlled from ANSI as well), like:
Code: |
\e[1z<font back=blue>word1\e[31mword2</font>\n |
This, in CMUD, will display only the first word with blue background (even though the ANSI code sets just foreground). In mushclient, though, the background will span for both words. I am not sure which is correct, but this detail should also be covered in the spec.
And great news about the new site, it is certainly needed! ;) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 16, 2010 10:34 pm |
Are you testing this in the 3.14 Beta version? or the 2.37 version? The 2.37 CMUD version still had bugs with ANSI within MXP. I had thought these bugs were fixed in the 3.14 Beta, so if you still find the problems there, post again and let me know. Doing ANSI within MXP has definitely been tricky in CMUD and hasn't gotten a ton of testing.
Changing the ANSI color definitely shouldn't be changing the background color. ANSI codes should only override those codes specified. |
|
|
|
Ghorin Newbie
Joined: 15 Mar 2010 Posts: 5
|
Posted: Tue Mar 16, 2010 11:13 pm |
Whoops, sorry, I've indeed tested them on 2.37... but from tests on 3.14a, the first bug (permanent font) seems to be fixed; the background resetting (my last post) is still here - ie. ANSI foreground resets MXP background. However, it only happens if ANSI starts as "reset" at the beginning of the line. (or was reset sometime earlier)
That is:
Code: |
\e[0m\e[1z<font back=blue>word1\e[31mword2</font>\n |
clears the background in the middle, while for example:
Code: |
\e[30m\e[1z<font back=blue>word1\e[31mword2</font>\n |
works fine (the background spans for both words). |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Mar 16, 2010 11:55 pm |
OK, that actually makes sense and will help me track down the problem. The ANSI reset is causing the ANSI background color to be set to the default, and when the later ANSI code gets executed, CMUD is taking the background from the previous ANSI setting and not the MXP setting. The code is all very messy.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|