 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Sat Sep 01, 2007 12:49 pm
[2.02] ANSI colour after </send> in #SUB - Text is black causing invisible text |
This one took me a surprising length of time to track down before I realised that the text was invisible! Black text on a black background for everything after the </send>. (I tried various combinations of removing the ~ and adding quotes but nothing helped.) (I know the text is there because I can see it if I select the line with mouse.)
Code: |
Pattern:
^(%w) ({tells|asks}) you '(*)$
Value:
#SUB {"~<send 'whois &text;'~>"%1~</send~> %2 you '%3}
|
or in XML:
Code: |
<trigger priority="23130" id="2313">
<pattern>^(%w) ({tells|asks}) you '(*)$</pattern>
<value>#SUB {"~"%1~ %2 you '%3}</value>
</trigger>
|
The text from the mud must have an ANSI colour - it works fine if no ANSI colour (other than default) was specified, but I have tried several colours and there are all the same.
Just to clarify - the whole line has the same ANSI code from the mud:
Quote: |
<ESC>[31;1mSomeBot tells you 'Blah blah blah'<ESC>[0m<CR><LF><CR><LF> |
SomeBot is in bold red, and everything afterwards has black text when it should also be in bold red. |
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sat Sep 01, 2007 2:41 pm |
I would write that #SUB more like this:
Code: |
#SUB "<send 'whois &text;'>"%1"</send> "%2" you '"%3 |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Sep 01, 2007 2:50 pm |
The code tag really needs fixing :(
Confirmed - I couldn't find a reliable way to reproduce this offline, but with actual MUD text, it worked... well, didn't work.
Also, a few stylistic notes - you can use %1 instead of &text; to avoid having to quote out that tag if you think that looks ugly (personally, I do). Also, in CMUD the <> characters aren't special and don't need quoting. Finally, you don't need so many captures - you could change the pattern to (%w) ({tells|asks} you '*)$ and then use #sub{<send>%1</send>%2} if you think that looks neater. |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Sat Sep 01, 2007 3:11 pm |
Thanks for the stylistic tips - some of the reasons it is the way it is, is because I want it to work in zMUD too, and because in actual fact the original script was a quite a lot longer, and the original pattern has another parameter. I simplified it when tracking down this bug.
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Sep 01, 2007 3:56 pm |
I've seen this as well. Curious that it doesn't happen offline.
|
|
_________________ Asati di tempari! |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Sat Sep 01, 2007 4:43 pm |
Is it even possible to test this offline though? How would you do it? By putting a %ansi into a #SHOW from the command line? I suppose that is not quite the same... And indeed, doing so has the expected, correct, behaviour.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 03, 2007 5:17 pm |
Could someone capture some text that shows this happening using the #DEBUG command so that I can replay it here. Otherwise this is going to be a pain to find.
|
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Mon Sep 03, 2007 7:54 pm |
Well, I think this problem is actually caused by something lower down that is also causing this problem: [2.02] %linecol issues
But I did actually capture a #DEBUG if you want it - I didn't know how to name each file though - which one is which? Do you still need it, given this other issue I posted that can be reproduced offline? I quoted the interesting part out of the DEBUG files in my first post anyway. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 03, 2007 9:26 pm |
Yes, still send me both files. The first filename is the one that I can replay. The second filename is the human-readable file that you quoted at the beginning of this post.
What's important about both files is that they show me the actual packet structure so that I can see where the package boundaries are. That can sometimes cause the difference between the live MUD and offline testing. |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Mon Sep 03, 2007 11:14 pm |
Sent to sales. They both look like plain text to me!
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Sep 03, 2007 11:23 pm |
They are, but the first file contains all the control characters as they were received from the MUD - it's the exact text that CMUD saw. The second is human-readable - the control characters are changed into readable text, and the package boundaries are marked more clearly.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Sep 04, 2007 12:43 am |
OK, got the files and I was able to reproduce the problem!
A couple of other notes:
1) Your trigger pattern seems to be missing a ' at the end. I had to use a pattern of
Code: |
^(%w) ({tells|asks}) you '(*)'$ |
2) Seems to be another bug dealing with the $ at the end of the line. It was getting converted to a \n in the RegEx pattern, which isn't right. When I removed the $ and then replayed the debug.raw file that you sent, I got the problem with the black on black text after the SEND.
Edited: Nevermind, I understand now why there isn't a ' at the end. And now I cannot reproduce the problem that I had with $ originally :(
Well, at least I've got the color problem fixed now.
Edited: And now I've found a new problem with &text; not working within <SEND>
Edited (again): The problem with $ was that when I copied/pasted from the forums, there was a space after the $. So the $ got turned into a \n line break. So this wasn't a bug, just a problem with the trailing space. Also, I have fixed the parsing problem that prevented &text; from working.
Finally, remember that the < and > characters no longer need to be escaped in CMUD. So, I was able to get the following to work in v2.03:
Code: |
Pattern:
^(%w) ({tells|asks}) you '(*)$
Value:
#SUB {"<send 'whois &text;'>"%1</send> %2 you '%3} |
with all of your problems fixed :). |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Tue Sep 04, 2007 1:24 am |
Nice! I guess you worked it out, but the reason I don't have a ' before the $ is in case the MUD wraps the line.
|
|
|
 |
|
|