|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Sat Nov 08, 2008 11:11 am
[2.37] HTML logging broken? Still buggy in [3.09] |
When I try to save buffer to a long only ansi colors are converted to correct tags.
Other colors are replaced with <span style="color:#000000;">
I wonder if I'm doing something wrong
Example:
Code: |
trigger priority="90" id="9">
<pattern>ansi color</pattern>
<value>#COLOR yellow</value>
</trigger>
<trigger priority="80" id="8">
<pattern>other color</pattern>
<value>#COLOR #123465</value>
</trigger> |
I execute following commands:
#clr
#show ansi color
#show other color
When I do "Save Buffer..." with "Log MXP/HTML" option set my log file looks like:
<span style="color:#FFFF00;">ansi color</span><BR/>
<span style="color:#000000;">other color</span><BR/>
I believe it worked correctly in older versions (2.24?) but I'm not sure. |
|
Last edited by Dwoggurd on Sat Jul 18, 2009 8:57 pm; edited 3 times in total |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 10, 2008 5:37 pm |
Does this happen when using normal logging, or only when using the Save Buffer command after the fact?
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Tue Nov 11, 2008 5:20 pm |
Happens when using normal logging too.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Nov 11, 2008 5:45 pm |
Confirmed and added to bug list. Seems the problem is actually with the #COLOR, #CW or #SUB commands. If the MUD itself sends you text with that color, then it gets logged correctly.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Feb 05, 2009 10:21 pm |
Fixed for v3.04. This was the same bug as the other #CW bug that I fixed today. It was effecting color logging as well.
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Fri Mar 13, 2009 4:39 am |
[3.05] still buggy.
When text from a mud comes with ansi color codes and I try to replace it with different (non-standard) color using #PCOL, it is not saved correctly to a html log.
How to reproduce:
Trigger:
Code: |
<trigger priority="2040" case="true" regex="true" id="16">
<pattern>(misses) you\.$</pattern>
<value>#PCOL #654321 %x1</value>
</trigger>
|
Incoming text:
<100% 100% 100%>
Your pierce scratches the fleshy creature.
You feel a surge of confidence as the battle goes in your favor!
The fleshy creature's claw misses you.
The fleshy creature has some small but disgusting cuts.
Debugger:
Code: |
0.0027 | h test |<ESC>[0S<100% 100% 100%> <ESC>[0m
0.0027 | a test |Your pierce scratches the fleshy creature.
0.0025 | h test |<ESC>[0SYour pierce <ESC>[31mscratches<ESC>[0S the fleshy creature.<ESC>[0m
0.0030 | a test |You feel a surge of confidence as the battle goes in your favor!
0.0027 | h test |<ESC>[0SYou feel a surge of confidence as the battle goes in your favor!<ESC>[0m
0.0026 | a test |The fleshy creature's claw misses you.
0.0024 | h test |<ESC>[0SThe fleshy creature's claw <ESC>[31mmisses<ESC>[0S you.<ESC>[0m
0.0025 | f test | Pattern: (misses) you\.$ : (%1="misses")
0.0033 | c test | exec : Pattern "(misses) you\.$" : #PCOL #654321 %x1
0.0024 | g test =[0SThe fleshy creature's claw [0Smisses[0S you.[0m
0.0043 | a test |The fleshy creature has some small but disgusting cuts.
0.0026 | h test |<ESC>[0SThe fleshy creature has some small but disgusting cuts. <ESC>[0m
|
The color on the screen for "misses" becomes brown (as expected), but in a html log it's saved as "#000000":
Code: |
<100% 100% 100%> <br/>
Your pierce <span style="color:#800000;">scratches</span> the fleshy creature.<br/>
You feel a surge of confidence as the battle goes in your favor!<br/>
The fleshy creature's claw <span style="color:#000000;">misses</span> you.<br/>
The fleshy creature has some small but disgusting cuts. <br/>
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Mar 13, 2009 6:56 pm |
I'll add this back to the bug list. Not sure why it works with #CW and not #PCOL.
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Sat Mar 14, 2009 2:35 pm |
There is some mess with how ansi and non-ansi colors interact together. Some of them come from a mud and some are brought by triggers.
More experiments:
Triggers:
Code: |
trigger priority="130" case="true" regex="true" id="13">
<pattern>pcol=(ansi1)===(ansi2)==</pattern>
<value>#CW cyan
#PCOL #232425 %x1
#PCOL green %x2</value>
</trigger>
<trigger priority="140" case="true" regex="true" id="14">
<pattern>pcol=(custom1)===(custom2)==</pattern>
<value>#CW #440044
#PCOL #232425 %x1
#PCOL green %x2</value>
</trigger>
|
alias to invoke them:
Code: |
<alias name="go" id="10">
<value><![CDATA[#clr
#show pcol=[31mansi1[0m===ansi2=======
#show pcol=[31mcustom1[0m===custom2=======]]></value>
</alias>
|
On the screen everything is as expected (below colors are corrected slightly)
pcol=ansi1===ansi2=======
pcol=custom1===custom2=======
In a html log this is saved as:
Notice "000000" color in the first line and messy <span> tags in the second line
Code: |
<span style="color:#008080;">pcol=</span><span style="color:#000000;">ansi1</span><span style="color:#008080;">===</span><span style="color:#00B300;">ansi2</span><span style="color:#008080;">==</span>=====<br/>
<span style="color:#440044;">pcol=<span style="color:#232425;">custom1<span style="color:#440044;">===</span><span style="color:#00B300;">custom2==</span></span><span style="color:silver;">=====</span></span><br/>
<br/>
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Apr 17, 2009 8:17 pm |
When I tried to reproduce this again to fix it, I couldn't get it to fail. I've already fixed some other color problems a couple weeks ago, so maybe this bug was related to them. Let me know if it still doesn't work in v3.06.
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Fri Apr 17, 2009 11:49 pm |
Still buggy in 3.06.
It looks like in 3.06 PCOL isn't always closed correctly. On a screen it's ok but in a log PCOL-colored pattern isn't closed until the end of the line. It happens when I try to recolor some text that already has ansi colors coming from a mud
For triggers above I get this log:
Code: |
<span style="color:#008080;">pcol=<span style="color:#232425;">ansi1</span></span><span style="color:#008080;">===</span><span style="color:#00B300;">ansi2</span><span style="color:#008080;">=======</span><br/>
<span style="color:#440044;">pcol=<span style="color:#232425;">custom1<span style="color:#440044;">===</span><span style="color:#00B300;">custom2<span style="color:#440044;">=======</span></span></span><br/>
|
Another simplier example:
Trigger:
Code: |
<trigger priority="2040" case="true" regex="true" id="16">
<pattern>(misses) you\.$</pattern>
<value>#PCOL #654321 %x1</value>
</trigger>
|
Alias to invoke:
Code: |
<alias name="go" id="10">
<value><![CDATA[#clr
#show monster misses you.
#show monster [31mmisses[0m you.]]></value>
</alias>
|
Resulting log.
For a line without colors the log looks correct.
For a line with original ansi color (misses) the trigger recolors it and in the log closing-span-tag is placed at the end of the line.
Code: |
monster <span style="color:#654321;">misses</span> you.<br/>
monster <span style="color:#654321;">misses you.</span><br/>
|
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Sun Apr 19, 2009 6:59 pm |
More experiments.
It looks like there is some mess when original mud output has ansi colors.
And I have a wild guess (probably false) that there is some specific additional miss with red ansi color "31m"
Triggers (trimmed)
Code: |
<trigger priority="2030" case="true" regex="true" id="87">
<pattern><![CDATA[^(Your?.*) (devastates?|MUTILATES?) (.+)$]]></pattern>
<value>#PCOL lightcyan %x1
#PCOL yellow %x2
#PCOL lightcyan %x3</value>
</trigger>
<trigger priority="2040" case="true" regex="true" id="88">
<pattern><![CDATA[(devastates) you(.|!)$]]></pattern>
<value>#PCOL pink %x1</value>
</trigger>
<trigger priority="2050" case="true" regex="true" id="89">
<pattern>^You parry</pattern>
<value>#CW lightcyan</value>
</trigger>
|
Raw mud output:
Harkrin parries your pierce.<LF><CR>
Your crush <ESC>[31mdevastates<ESC>[0m Harkrin!<LF><CR>
Your pierce <ESC>[31mMUTILATES<ESC>[0m Harkrin!<LF><CR>
Harkrin's punch <ESC>[31mdevastates<ESC>[0m you!<LF><CR>
You parry Harkrin's punch.<LF><CR>
Harkrin has a few scratches. <LF><CR><LF><CR>
Debugger output. Notice some mess with red color, it is closed only at the end of the line
a Test |Harkrin parries your pierce.
a Bobik |Your crush devastates Harkrin!
f Test | Pattern: ^(Your?.*) (miss|misses|scratch|scratches|grazes?|hits?|i... : (%1="Your crush", %2="devastates", %3="Harkrin!")
c Test | exec : Pattern "^(Your?.*) (miss|misses|scratch|scratches|grazes...
g Test =Your crush [53mdevastates Harkrin![0m
a Test |Your pierce MUTILATES Harkrin!
f Test | Pattern: ^(Your?.*) (miss|misses|scratch|scratches|grazes?|hits?|i... : (%1="Your pierce", %2="MUTILATES", %3="Harkrin!")
c Test | exec : Pattern "^(Your?.*) (miss|misses|scratch|scratches|grazes...
g Test =Your pierce [53mMUTILATES Harkrin![0m
a Test |Harkrin's punch devastates you!
f Test | Pattern: (misses|scratches|grazes|hits|injures|wounds|mauls|decima... : (%1="devastates", %2="!")
c Test | exec : Pattern "(misses|scratches|grazes|hits|injures|wounds|mau...
g Test =Harkrin's punch devastates you![0m
a Test |You parry Harkrin's punch.
f Test | Pattern: ^You parry
c Test | exec : Pattern "^You parry" : #CW lightcyan
g Test =You parry Harkrin's punch.[0m
a Test |Harkrin has a few scratches.
That is what I see on my screen (colors corrected slightly for BBcode). And, actually, that's what I wanted to see. I'm not sure if the internal representation is correct, but the appearance is what I expected to see.
Harkrin parries your pierce.
Your crush devastates Harkrin!
Your pierce MUTILATES Harkrin!
Harkrin's punch devastates you!
You parry Harkrin's punch.
Harkrin has a few scratches.
HTML log. Tags for previously ansi-red-colored things are placed in a wierd manner, closing-span is at the end of the line. Another issue: line "You parry..." is colored entirely while it should be only #CW (like on my screen output) and it had no colors, just plain text, maybe its fault was just to come after previous messy lines
Code: |
Harkrin parries your pierce.<br/>
<span style="color:lightcyan;">Your crush </span><span style="color:#FFFF00;">devastates <span style="color:lightcyan;">Harkrin!</span></span><br/>
<span style="color:lightcyan;">Your pierce </span><span style="color:#FFFF00;">MUTILATES <span style="color:lightcyan;">Harkrin!</span></span><br/>
<span style="color:lightcyan;">You parry Harkrin's punch.</span><br/>
Harkrin has a few scratches. <br/>
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Apr 20, 2009 5:02 pm |
I'll put this back on the bug list to take another look at it. I agree that the problem seems to happen when mixing #PCOL using MXP colors on lines that already have ANSI color.
|
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Tue Apr 28, 2009 7:19 pm |
One more problem:
This is not exactly logging issue but rather a run-time issue (which probably cause logging issues as well).
Trigger:
It may look a bit wierd but its purpose is to split an incoming line with a prompt and an arbitrary text into two lines: the prompt and the the text, also preserving original colors.
Code: |
<trigger priority="101" case="true" ansi="true" stop="true" regex="true" id="18">
<pattern><![CDATA[(^(\[0[Sm])?<.*\d+.*\d+.*\d+.*> )(?!\[0m$)(.+)$]]></pattern>
<value>#GAG
#IF (%2 = %null)
{
#PRINT "[0S"%1
}
{
#PRINT {%1}
}
#SHOW %3</value>
</trigger>
|
How to invoke/reproduce:
#show <[31m10[0mhp 1 1> you fled!
Result on my screen:
<10hp 1 1>
you fled!
The red color is not closed. It should be only "10" that is colored, not the rest of the line.
This is somewhat new problem introduced in 3.06. I haven't seen that before. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Apr 28, 2009 8:24 pm |
This code displays just fine here from the command line:
Code: |
#show <%e[31m10%e[0mhp 1 1> you fled! |
Are you saying that isn't working from your command line?
Since this isn't related to HTML logging, it really ought to have been a new thread. |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Tue Apr 28, 2009 8:44 pm |
I'm saying that the trigger output is not what I expect to see.
The "show" command is just supposed to fire the trigger and it works (I guess).
This issue is run-time but the problem is very closely related to what happens with HTML logging. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Apr 29, 2009 12:50 pm |
Your formatting is incorrect. Change this:
Code: |
#IF (%2 = %null)
{
#PRINT "[0S"%1
}
{
#PRINT {%1}
}
|
to this:
Code: |
#IF (%2 = %null)
{
#PRINT "[0S"%1
} {
#PRINT {%1}
}
|
Basically, by putting a carriage return before the False statement of the #if, you are making it into a separate clause, not part of the #if clause. |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Wed Apr 29, 2009 4:37 pm |
Rahab wrote: |
Basically, by putting a carriage return before the False statement of the #if, you are making it into a separate clause, not part of the #if clause. |
Can you prove it? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Apr 29, 2009 7:58 pm |
Rahab is correct about this. CMUD wants the { at the end of the line that starts with the } and not on it's own separate line. It's possible the parser might handle it, but it might be something that will break in the future as it is not officially supported syntax. You can use the Reformat command in the Editor menu to tell CMUD to format your script properly.
More importantly, I'm guessing your script has some hidden ESC control codes embedded in it, which are not being displayed on the forum. You should always try to avoid embedded control characters. You can use the %e variable in CMUD for the ESC character. Also, using the [0S option to try and force the default style isn't something you should be messing with. The internal style implementation is using non-standard ansi codes and could change in the future. The proper way to reset the ANSI color back to the default is with:
#PRINT %ansi(reset) |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Wed Apr 29, 2009 8:28 pm |
Zugg wrote: |
CMUD wants the { at the end of the line that starts with the } and not on it's own separate line. It's possible the parser might handle it, but it might be something that will break in the future as it is not officially supported syntax. You can use the Reformat command in the Editor menu to tell CMUD to format your script properly. |
It is disgusting.
Sorry, Dwoggurd, for stealing your thread. I'll not post here anymore. |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Wed Apr 29, 2009 8:32 pm |
Thanks for hints.
I used [0S to remove the default PRINT color. I wonder if we have more clever way to do that for PRINT/SAY (instead of using %ansi(reset) or ESC codes).
Can we update #IF syntax (and other statements syntax) in the documentation? I don't remember seeing brackets restrictions and it works fine for me so far when I put them on separate lines (I guess I just got lucky).
My script has no additinal ESC codes expect that one before #PRINT (and in the trigger's pattern). By the way, what is a correct way to put ESC codes in patterns?
I made these syntax changes but the problem is still there (not affected at all).
Updated trigger:
Code: |
<trigger priority="101" case="true" ansi="true" stop="true" regex="true" id="18">
<pattern><![CDATA[(^(\[0[Sm])?<.*\d+.*\d+.*\d+.*> )(?!\[0m$)(.+)$]]></pattern>
<value>#GAG
#IF (%2 = %null)
{
#PRINT %ansi(reset)%1
} {
#PRINT {%1}
}
#SHOW %3</value>
</trigger>
|
However, the problem disappeared when I replaced ESC code with %ansi in SHOW command that supposed to mimic real mud output.
Command to fire it:
#show <%ansi(red)10%ansi(reset)hp 1 1> you fled!
this worked fine.
#show <[31m10%ansi(reset)hp 1 1> you fled!
This one doesn't work well (displays the prompt with red color unclosed).
Exactly the same happens when I'm online and use real mud output instead of SHOW command. While I can change my SHOW commands I can't really do much about mud output and I don't see anything wierd there in the debugger window. Just two ANSI codes that color the number of hps in red. |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Wed Apr 29, 2009 8:45 pm |
One more addition.
This problem seems only exists for simple ANSI ESC codes. I can't reproduce it for bold codes.
What I mean (mud text is taken from the script debugger):
<<ESC>[31m16%<ESC>[0mhp 100%m 99%mv>
This one displayed with unclosed red color after my trigger fires
g test |-> Line 1247 gagged
a test |
a test ]<16%hp 100%m 99%mv>
h test ]<<ESC>[31m16%hp 100%m 99%mv> <ESC>[0m
<<ESC>[33;1m27%<ESC>[0mhp 100%m 100%mv>
This one is displayed fine. The only difference I see here is "longer" ESC sequence for yellow color.
g test |-> Line 1265 gagged
a test |
a test ]<27%hp 100%m 100%mv>
h test ]<<ESC>[1;33m27%<ESC>[0mhp 100%m 100%mv> <ESC>[0m
PS. And the original problem with HTML logging seems depends (but is wider) on how CMUD internally reformats incoming ANSI colored text. Even if I see it correctly on my screen, a HTML log is still broken.
It looks like this
<<span style="color:#800000;">10hp 1 1> </span><br/>
you fled!<br/>
<<span style="color:#FFFF00;">10hp 1 1> </span><br/>
you fled!<br/>
for both colors, red and yellow |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Apr 30, 2009 1:39 pm |
Using %ansi IS the clever way to change the default color of #print.
You must have been lucky. I have seen #if statements work incorrectly a number of times if the fail statement is placed on a completely separate line. I don't see any reason to change the #if documentation--there is nothing in there to suggest that you can put it on a separate line.
Replace the embedded escape codes with %e. The reason the embedded escape code doesn't work well in the #show is that it is not expected to work. Don't use embedded escape codes. The mud output will get interpreted correctly. It is the zscript code that should not have embedded escape codes, because that can mess up the scripts. You still have embedded escape codes in the trigger pattern.
Both of your examples seem to work fine for me here, once I properly replace those escape codes with %e. |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Thu Apr 30, 2009 5:16 pm |
I tried to replace ESC with %e in my trigger, but while my trigger works for #SHOW command (that uses %ansi) it doesn't work for real mud output or #SHOW with ESC char. That's my original problem. #SHOW doesn't let me to reproduce the problem if I don't put ESC codes into it. I would really appreciate any hint how to mimic the real mud output, so I could reproduce things offline.
Another question, how I can mimic real mud output that is supposed to fire prompt triggers (triggers that has "prompt" option and supposed to fire on the end of a block, not the end of a line)
One more question. Can you look at HTML log? For me even if I don't see any problem on my screen, my HTML log is still screwed.
PS. Considering #IF syntax. When I reformat scripts with ctrl+M, CMUD puts else-statement on a separate line in many cases. This may be misleading, so it's always good to have syntax description in the documentation. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Apr 30, 2009 6:20 pm |
An %e in your #show command gets replaced by cmud with the escape character as it processes it, so it is exactly as if the mud sent the escape character. Embedding an actual escape character in #show or a script can mess things up, so any testing using that is worthless. It's not expected to work.
To see what your mud is actually sending, you can try this: in your session window, highlight the mud prompt you want to check out. Hit ctrl-c to copy it. In your package editor, create a new blank trigger. Mark the Ansi Trigger checkbox. Then click in the trigger pattern and ctrl-v to paste the prompt text. You will notice that cmud replaces the escape character with %e when pasting to the ansi trigger pattern. To use that same text in a #show, you may have to massage it a bit, by quoting some of the special characters with a tilde ~.
To simulate a prompt line from the mud, use the #sendprompt command.
This is the first time you've said this is different on your main screen and in the HTML log. When you started talking about it, you said it was not an HTML logging problem. I'll see if I can get a problem to show up in HTML logging. |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Thu Apr 30, 2009 7:15 pm |
The whole thread is about HTML loggin problem.
With 3.06 fixes the nature of HTML logging bugs has changed.
In 3.06 the main problem I see is unclosed colors. It can be reproduced without any ESC chars in triggers, several posts above you can see examples with coloring triggers (~17-19 Apr)
However, in 3.06 in some rare case the very similar problem (unclosed color) started to happen run-time (on my screen, not only in a log). My guess that these problems are related somehow, so it probably makes sense to fix them together.
So far fixing syntax didn't help with any of these problems. While I certainly welcome any hints how to write this or that thing in a clever way, there are issues I can't fix by syntax changes.
This particular run-time problem with the trigger above and unclosed color happens to me when I'm online and to reproduce it offline I have to use ESC in #SHOW. If I change #SHOW to use "right" approach and %e or %ansi codes this will just disable the possibility for me to reproduce my problem offline, but it does not help to actually fix the problem.
I don't get the idea of #sendprompt. It sends a prompt TO the mud, but how I can mimic a prompt FROM the mud to fire my prompt triggers offline? By the way, the "prompt" trigger in this thread is not a real trigger prompt. It's just an ordinaly end-of-line trigger that is supposed to split a prompt and a text when they come from a mud together. |
|
|
|
|
|