|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sat Apr 29, 2006 8:18 pm
Escape Code Replacement |
Looked in the boards and can't find this.
\033ci=0,32,225\033Skills and Actions:\033ci=0,0,0\033
I need to replace some of these with ansi codes.
\033 = ESC
I tried
#TRIG {%eci=%d,%d,%d%e} {#SUB {Whatever}}
but it doesn't seem to work. Doesn't even match.
Any suggestions would help greatly,
Raven |
|
|
|
Arcane_of_Discworld Wanderer
Joined: 29 Jan 2002 Posts: 99 Location: UK
|
Posted: Sat Apr 29, 2006 8:38 pm |
Matching is as follows:
Code: |
#TRIG {^(~\%dci~=%d~,%d~,%d~\%d)Skills and Actions~:(~\%dci~=%d~,%d~,%d~\%d)} {#SUB {whatever}} |
or
Code: |
#TRIG {^(*)Skills and Actions~:(*)} {#SUB {whatever}} |
They both capture the patterns preceding and following 'Skills and Actions' into parameters %1 and %2 |
|
|
|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sat Apr 29, 2006 8:55 pm |
Code: |
#TRIG {^(~\%dci~=%d~,%d~,%d~\%d)Skills and Actions~:(~\%dci~=%d~,%d~,%d~\%d)} {#SUB {whatever}} |
Code: |
#TRIG {^(*)Skills and Actions~:(*)} {#SUB {whatever}} |
Although very helpful this won't work becuase I need to replace the ESCci=0,0,0ESC on a lot of other lines then just skills and actions. I need to replace it with an ansi color code actually on almost every line in the mud. And I need to rematch the line more then once becuase it may be repeated in the line two or more times.
\033 is decimal representation of the escape character. |
|
|
|
Arcane_of_Discworld Wanderer
Joined: 29 Jan 2002 Posts: 99 Location: UK
|
Posted: Sat Apr 29, 2006 9:14 pm |
My apologies.. must have had a blonde moment =)
Where did you get the original '\033ci=0,32,225\033' from as I am unfamiliar with that format...
From testing a coloured line of text on the mud I play capturing the line in the specified way (create new trigger -> select 'ansi' on the options panel of the new trigger -> highlight the line containing the colour codes -> paste it into the 'pattern' field of the trigger using Ctrl + v) I get the following in the pattern field:
Code: |
%e[1;34mTEXTFROMTHELINE %e[1;35mTEXTFROMTHELINE %e[1;34mTEXTFROMTHELINE |
If you want to have zMud always display certain colours from the mud with a different colour you might be better off changing the colour mapping instead (Prefs -> Colors)
My apologies again if I am missunderstanding what your trying to achieve. |
|
|
|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sat Apr 29, 2006 9:22 pm |
You might be right about the color mapping.
I am connecting a a mud that uses a Java client by default, and that paticular syntax for color.
It isn't telnet or zmud compatible as far as the escape codes go.
Kinda reminds me of connecting to DragonRealms before zmud was compatible with it.
\033 is the Perl Expression for ESC |
|
|
|
Arcane_of_Discworld Wanderer
Joined: 29 Jan 2002 Posts: 99 Location: UK
|
Posted: Sat Apr 29, 2006 9:48 pm |
Just did some further testing by converting the ansi codes captured on my output to Perl regular expression (option on the trigger panel) .. it looks like \033 should be recognised as the escape character as the output changed from what was above to:
Code: |
\033\[1;34m\TEXTFROMTHELINE \033\[1;35mTEXTFROMTHELINE \033\[1;34mTEXTFROMTHELINE |
How you would deal with the remainder of the codes is beyone me.. good luck with it though. |
|
|
|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sat Apr 29, 2006 9:58 pm Okay |
I think it is a problem with Zmud not sending ESC to the triggers. Even with Ansi Trigget enabled. I think I have to devise something to parse the text before it gets to zmud. It'll take longer I guess but it will work better.
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sat Apr 29, 2006 10:12 pm |
What's the mud address?
|
|
_________________ Taz :) |
|
|
|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sat Apr 29, 2006 10:25 pm |
Taz,
Won't give the specs on how to connect via zMud as I think it is against thier policy.
Have had zMud too long not to work with it in any mud.
<27> is the same as \033 just another way of displaying it I think.
PM me if you want the game name
i=0,0,0his alley is bordered by buildings to the north and south. A flat iron sign
i=0,0,0as been hammered into the door to the south. A deep wagon rut has been gouged
i=0,0,0nto the street nearby. A burnt-out shell of a two-story gray building squats
i=0,0,0n thick rock pilings to the north. A metal-reinforced clay brick building sits
i=0,0,0ust to the south. A low building made from stone blocks lies just to the
i=0,0,0outhwest.
i=0,0,0ou are facing north. You see a i=0,205,32ide alleyi=0,0,0to the i=0,205,32asti=0,0,0and to the i=0,205,32esti=0,0,0 and
i=0,0,0 i=100,100,100oori=0,0,0to a metal-reinforced clay brick building to the i=100,100,100outhi=0,0,0
i=0,0,0 short metal beam, a crude clay bottle, a die, a die, a die, a pile of
i=0,0,0rimy leather pouches, and a pile of pouches are scattered about here.
i=0,0,0A thick crowd of people gradually make their way past you.
or This if I turn off Emulation of Escape codes.
<27>[2zl
<27>ci=0,0,0<27>This alley is bordered by buildings to the north and south. A flat iron sign
<27>ci=0,0,0<27>has been hammered into the door to the south. A deep wagon rut has been gouged
<27>ci=0,0,0<27>into the street nearby. A burnt-out shell of a two-story gray building squats
<27>ci=0,0,0<27>on thick rock pilings to the north. A metal-reinforced clay brick building sits
<27>ci=0,0,0<27>just to the south. A low building made from stone blocks lies just to the
<27>ci=0,0,0<27>southwest.
<27>ci=0,0,0<27>You are facing north. You see a <27>ci=0,205,32<27>wide alley<27>ci=0,0,0<27> to the <27>ci=0,205,32<27>east<27>ci=0,0,0<27> and to the <27>ci=0,205,32<27>west<27>ci=0,0,0<27>; and
<27>ci=0,0,0<27>a <27>ci=100,100,100<27>door<27>ci=0,0,0<27> to a metal-reinforced clay brick building to the <27>ci=100,100,100<27>south<27>ci=0,0,0<27>.
<27>ci=0,0,0<27>A short metal beam, a crude clay bottle, a die, a die, a die, a pile of
<27>ci=0,0,0<27>grimy leather pouches, and a pile of pouches are scattered about here.
<27>ci=0,0,0<27> A teeming mass of people gradually make their way past you. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sat Apr 29, 2006 11:50 pm |
Damn it's a shame %ansi doesn't toggle rather than requiring something after it to apply the ansi codes to, otherwise all you would need is
Code: |
#trigger {~<27~>ci=0,0,0~<27~>} {#sub %ansi(white)}
#trigger {~<27~>ci=0,205,32~<27~>} {#sub %ansi(blue)} |
etc. |
|
_________________ Taz :) |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Apr 30, 2006 2:50 am |
This really is plugin territory, but there is a way to do it. MXP still works when the emulate control codes is off, so by producing a trigger that does some replaces with the MXP color tag you can get the colors working. As those values seem to be an RGB notation all you would have to do is math them up. It would also require turning off the "Allow <> for expansion" in the script parse preferences.
#CLASS ColorConvert
#VARIABLE Line {} {}
#VARIABLE Code {} {}
#VARIABLE R {} {}
#VARIABLE G {} {}
#VARIABLE B {} {}
#TRIGGER {*} {Line=%line;#WHILE (%match(@Line,"(<27>ci=(\d+),(\d+),(\d+)<27>)",Code,R,G,B)) {Line=%replace(@Line,@Code,%concat("</color><color ",%eval(@R+256*@G+65536*@B),">"))};#SUB {@Line}} "" {prompt|notrig}
#CLASS 0
That should do it. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Ravenbait Beginner
Joined: 29 Apr 2006 Posts: 11
|
Posted: Sun Apr 30, 2006 5:10 am |
Thanks alot Vijilante,
I tried to test this out but it didn't work. I think I can tweak it a little to get it to work, but this gives me a good head start. |
|
|
|
Nym Beginner
Joined: 17 Apr 2001 Posts: 12 Location: USA
|
Posted: Mon May 01, 2006 2:56 am |
I see a lot of i=0,0,0- what does that do? It looks like RGB values, but 0,0,0 would be black (as Vigilante's script would do. Do you have some example colors to go with that?) Is Taz right that 0,0,0 is white but otherwise it behaves as r,g,b 0-255?
Are normal color codes in use too? eg, ESC[34m type stuff. Any other control codes?
Nym |
|
|
|
|
|
|
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
|
|