|
Craivus Novice
Joined: 24 Jan 2001 Posts: 47
|
Posted: Fri May 14, 2004 7:04 am
Difficulty with an ANSI trigger |
I'm trying to develop a way of stringing together, for purposes of parsing, all of the contents in a particular room on my MUD. The items in the room are delineated only by color, however each item conveniently has the "item color" code right before it, and the code for white right after it.
Thus, I sought to match this pattern, simply at first, dealing only with a single line. The item color code is 36, the white code is 37.
This is the pattern I am using: %e[36m(*)%e[37m
It's not working properly.
It does match, on the following output from the MUD, which has to do with the weather (need to add some checking for that or somesuch):
Code: |
<27>[0;37m<27>[36mThe bright sun shines down, blanketing you with its life-giving warmth. <27>[37mHere |
It doesn't match, however, what I really want to match, items, such as in this:
Code: |
awaiting to assist you. <27>[36mA black cohosh root is here. <27>[37m<27>[33mYou see a sign here |
What am I doing wrong here?
EDIT:
Not sure if it's worth noting, but in the pattern tester the trigger works. I used:
[36mA black cohosh root is here. [37m[33mYou see a sign here
and sure enough it matched, with "A black cohosh root is here. " as it should. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri May 14, 2004 5:17 pm |
In this particular case, the displayed line is
awaiting to assist you. %e[36mA black cohosh root is here. %e[33mYou see a sign here%e[0m
Since your pattern specifies 37, it ignores 33.
The ending code could be any color change. I'd recommend looking for a text-based pattern (such as "is here.") to match at the end. |
|
|
|
Craivus Novice
Joined: 24 Jan 2001 Posts: 47
|
Posted: Fri May 14, 2004 6:30 pm |
I don't understand what you are saying. According to the output I am receiving from the MUD, taken from setting zMUD to not emulate color codes, I am indeed getting a 36 before each item and a 37 after each. Why would it ignore the 37?
A text-based pattern is really quite impossible here, the only differentiation is color, as I said earlier.
Thanks! |
|
|
|
Craivus Novice
Joined: 24 Jan 2001 Posts: 47
|
Posted: Fri May 14, 2004 7:39 pm |
While I still would appreciate an answer to the question in my earlier post, I think I sort of understand it. zMUD seems to strip any non-displayed color before it parses triggers, and also resets the ends of lines to black, and resets the next line to whatever color the last line was, all with ansi codes.
This is sort of strange.
Nevertheless, I have sort of used it to my advantage to make the following trigger, which seems to work beautifully so far:
Pattern: %e[36m(*)
Value:
#IF ((!%pos( "The bright sun shines down", "%1")) & (!%pos( "The stars twinkle in the clear night sky.", "%1"))) {
#IF %pos( %char( 27), "%1")) {roomcontents = %concat( @roomcontents, %stripansi( %left( "%1", %pos( %char( 27), "%1"))))} {
roomcontents = %concat( @roomcontents, %stripansi( "%1"))}} |
|
|
|
|
|
|
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
|
|