|
adalius Beginner
Joined: 23 May 2009 Posts: 15
|
Posted: Sun Jun 07, 2009 12:47 am
Question RE: #DEBUG and ANSI color codes. |
So I was monkeying around trying to debug some issues with ansi and a trigger I use and I noticed this oddity, maybe someone can explain it to me.
I have all the 'Messages' types turned on so I see everything I can in the Script Debugging Log.
I type #SH %ansi(green) TE.
I see a green TE on the screen.
I check the debugger, it shows
0.0002 | c 3Kingdom | [1] 3Kingdoms Comline : start :
0.0005 | a 3Kingdom |Te
0.0003 | d 3Kingdom | [1] 3Kingdoms Comline : stopped
I type #SH "<ESC>[32mTe"
Same results.
I type #SH <ESC>[32mTe without the quotes, I see:
0.0002 | c 3Kingdom | [1] 3Kingdoms Comline : start :
0.0004 | a 3Kingdom |""Te
0.0002 | h 3Kingdom |<ESC>[1S"<ESC>[32m"Te<ESC>[0m
0.0003 | d 3Kingdom | [1] 3Kingdoms Comline : stopped
Is there a reason the first two, despite showing in color properly, aren't throwing an 'h' line to the debugger with their ansi codes displayed?
Also, why is it suddenly sticking two double quotes in there in the last one? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 08, 2009 5:35 pm |
OK, what did you *really* type. Because if I just type:
then I get this in my script debugger:
Code: |
0.0004 | c untitled | [1] untitled Comline : start :
0.0009 | a untitled |<ESC>[32mTe
0.0003 | h untitled |<ESC>[32mTe
0.0004 | d untitled | [1] untitled Comline : stopped |
Are you trying to embed an ESC character somehow? If so, you should use %e for that. And remember that putting " quotes around something makes it a literal string and will not expand variables.
In order to get the <ESC>[1S in the second example, you must have used #SAY or #ECHO instead of #SHOW.
I confirmed the first example and I'm not sure why it's not showing an "h" line in the debugger, so I'll look into that one. |
|
|
|
adalius Beginner
Joined: 23 May 2009 Posts: 15
|
Posted: Mon Jun 08, 2009 10:36 pm |
I just tried it again. I copy pasted the commands I said I used here in the forum verbatim, only replacing the <ESC> with the actual escape character, obviously.
So they are, in order
#SH %ansi(green) TE
#SH "<ESC>[32mTe"
#SH <ESC>[32mTe
I double triple checked that I have all message outputs on.
My debugger output is now:
|
0.0004 | c 3Kingdom |[1] 3Kingdoms Comline : start :
0.0005 | a 3Kingdom | TE
0.0003 | d 3Kingdom |[1] 3Kingdoms Comline : stopped
27.943 | ---
0.0003 | c 3Kingdom |[1] 3Kingdoms Comline : start :
0.0006 | a 3Kingdom |Te
0.0003 | d 3Kingdom |[1] 3Kingdoms Comline : stopped
26.998 | ---
0.0002 | c 3Kingdom |[1] 3Kingdoms Comline : start :
0.0005 | a 3Kingdom |""Te
0.0003 | d 3Kingdom |[1] 3Kingdoms Comline : stopped
0.0000 |
So still no h lines, but as you pointed out, no scroll escape codes either (so it was likely I did muck up in my original trial and use an echo/say).
As for %e, I'm aware I should use %e, I was just monkeying around though.
I'm still confused though as to why the last command sticks two double quotes in there. If I ask it to show something without quotes, which is not to be treated like a literal, whats being expanded causing ""? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jun 09, 2009 12:22 pm |
I think it's fairly obvious that it's being caused by the escape character, which is exactly why you shouldn't use the escape character. If you do things you aren't supposed to do, you shouldn't be surprised if weird things happen.
|
|
|
|
adalius Beginner
Joined: 23 May 2009 Posts: 15
|
Posted: Wed Jun 10, 2009 12:07 am |
I'm assuming you're referring to the double quote bit, because the rest of my post (the lack of an 'h' line appearing) occurs even if I replace the <ESC> with a %e (although I have to change the one from "<ESC>[32mTe" to %e"[32mTe" as expected).
But more to the point, Rahab, I was mearly monkeying with the debugger trying to determine why some lines that were coming in *from* the mud were colored and not throwing an h line. So while you can make what came across as a very smarmy remark about doing things you aren't supposed to do, I was mearly trying to replicate some real world examples, because last I checked, what the mud sends you is by and large out of your control and may fall outside of what 'you're supposed to do'. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jun 10, 2009 8:39 pm |
I'm very sorry. I did not intend that to come across as a smarmy remark.
What I intended to express is that cmud will behave wierdly if it is given stuff that it should not be getting. When that happens, the explanation is simply that it was given stuff it should not be getting. |
|
|
|
|
|