 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Apr 08, 2008 5:24 pm
[2.22] ANSI problems |
Not sure if it's a bug or if I'm doing something incorrectly, but here is the situation.
I'm trying to capture a specific color pound sign (#), and I determined the ansi code for the color by logging it with ansi on. It returned [1;35m as the ansi code. Therefore, I wrote this trigger, hoping to capture it:
#TRIGGER {%e[1;35m#} {#SUB {%char(234)}}
Well, the results were not what I intended. Below is a screenshot. The top half is without triggers, the bottom half is with the triggers enabled.
I've also tried using ~# instead of just #, but to no avail. Adding [0m] afterwards didn't help, either.
Am I missing something here? Or is CMUD just being picky about the 1;35m bit?
Charneus |
|
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Apr 08, 2008 6:24 pm |
Make sure you have the ANSI color option enabled for the trigger. To enable it through the command, you'd use:
| Code: |
| #TRIGGER {%e[1;35m~#} {#SUB {%char(234)}} "" {color} |
|
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Apr 08, 2008 6:29 pm |
Right. I do have that enabled. In fact, I have another ANSI trigger, and that one works - the ansi code for that one is [36m. It's weird, regardless. I meant to have mentioned that I did have the ANSI box enabled. :P
Charneus |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Apr 08, 2008 9:07 pm |
This is actually a very old bug that dates back to zMud. #SUB doesn't know about the ANSI option. #SUB is figuring you have matched 8 characters, and are replacing them with 1 character. It also views the position for start of display differently because of the ANSI code.
It would be nice to see this bug go away once and for all. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Apr 08, 2008 9:22 pm |
So... do a (~#) capture and use #PSUB? Or does that have the same issue?
|
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Apr 08, 2008 9:35 pm |
Work around
| Code: |
#TRIGGER {%e[1;35m~#} {} "" {color}
#COND {(#)} {#PSUB {%char(234) %x1} {reparse} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Apr 08, 2008 10:07 pm |
Possible workaround that I haven't tried but that might work:
#TRIGGER {%e[1;35m#} {} "" {color}
#cond {#} {#SUB {%char(234)}} {reparse}
EDIT: Hah, great minds think alike. |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Apr 09, 2008 3:37 pm |
Well, Vijilante, yours did not work correctly. What wound up happening was something like this:
| Code: |
|[#] |[ ] < > [ ]| |--- --- ê 5 6 ê 5 6 |[ ] < >
------- |
Fang, yours worked for the most part... Instead of the above, I got:
| Code: |
---
|[ê]
|[ ] < > [ ]|
|--- ---
|[ ] < >
------- |
That's the way it's supposed to look. Now I've run into a new problem.
| Code: |
---
|.#.|
--- ---
|.ê. <ê. .ê.|
--- ---
|.#.|
--- |
The two ê's on either side are red, not the magenta that I'm subbing out. My guess is it has something to do with the reparse, though I'm not sure. Any suggestions?
Also, I'm using this trigger in a child window - seems I cannot sub it on the main window and capture it to the child window. This lags my system some - it captures it first, then subs it in the child window. Is there a quicker way? If need be, I can show you the script. :P
Charneus |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Apr 09, 2008 4:17 pm |
Viji's has a syntax error. It needs another } after %x1}.
|
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Apr 09, 2008 5:15 pm |
Right. I had fixed that - which is why it returned the first output. Otherwise, it wouldn't have returned anything. ;)
Charneus |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Wed Apr 09, 2008 11:53 pm |
I would say post a section of the human readable output from the #DEBUGFILE command so Zugg can recreate the problems with #SUB and #PSUB when used with an ANSI trigger. Then lets move the discussion for how to script portions of it into another topic in the General forum.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
|
|
|