Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
cheap_trixxx
Newbie


Joined: 24 Jul 2004
Posts: 4

PostPosted: Sat Jul 24, 2004 1:59 am   

coloring multiple lines... with a twist?
 
I know the problem of having a trigger color multiple lines has been addressed hundreds of times in past posts, but I haven't come across a solution for this particular situation.

Let's pretend the output from the MUD looks something like this:

The room smells of dead fish. A sign here reads, "Be wary
of ghosts of sailors past." A pile of gold lies on the
ground. A pair of black socks lie here.

In such a case, I'd be interested in coloring just the quoted phrase on the sign, or just the sentence saying A pile of gold lies here.

Now the MUD wraps text itself so I can't use a simple trigger. The text to be colored might be one line, two lines, etc. I've tried LightBulb's multiline solution (sample below) but it colors text beyond the end quote (that's exactly what I don't want). Any suggestions.

#TRIGGER {A sign here reads, ~"} {#T+ sign}
#TRIGGER "sign" {*} {#CW green} "" {disable}
#TRIGGER {.~" } {#T- sign}

I've tried both #CW and #COLOR, and have played around with #PCOL, all giving me mixed results. Btw, "sign" in this case is an ID not a class name. Again, suggestions?
_________________
If you want to soar with the eagles, don't fly with the turkeys.
Reply with quote
cheap_trixxx
Newbie


Joined: 24 Jul 2004
Posts: 4

PostPosted: Sun Jul 25, 2004 2:40 pm   
 
OK So I've made some headway as to figuring out why I can't get the result I want, but I'm still stuck...

First off, #CW doesn't work with wildcards the way I expected. #PCOL has to be used. So you get the code:

#TRIGGER {A sign here reads, ~"} {#T+ sign}
#TRIGGER "sign" {(*)} {#PCOL green %x1} "" {disable}
#TRIGGER {.~" } {#T- sign}

Now, the triggers are enabling and disabling appropriately so if I use the sample text provided before as my MUD output, I would at most get two lines coloured (the ones containing the quote). The problem is #PCOL automatically starts colouring from the start of line (I guess since I'm grabbing *). So the first step to a solution has to start the colouring from the quotation mark. Got that. But then I got stuck in making it end at another quotation mark and not necessarily the end of line. Any suggestions?
_________________
If you want to soar with the eagles, don't fly with the turkeys.
Reply with quote
cheap_trixxx
Newbie


Joined: 24 Jul 2004
Posts: 4

PostPosted: Sun Jul 25, 2004 7:44 pm   
 
OK. I've done it. It's sloppy, but it works; it will colour the text between two quotation marks and only that text. Unfortunately, it's limited to just 1 or 2 lines, but it's unlikely I'm going to come across a sign that reads more than two lines anyway. If anyone wants to clean this up I'd appreciate it, but no rush.

#CLASS {Colors|Signs}
#TRIGGER {It reads, "(*)} {
#VARIABLE str %param1
#VARIABLE endquote %pos(~", @str)
#IF (@endquote = 0) {#T+ c_option2} {#T+ c_option1}
}
#TRIGGER "c_option2" {@str} {#CW 7;#T+ next_line;#T- c_option2} "" {disable}
#TRIGGER "next_line" {^(*[.!?])"} {#PCOL 7 %x1;#T- next_line} "" {disable}
#TRIGGER "c_option1" {%left(@str,@endquote - 1)} {#CW 7;#T- c_option1} "" {disable}
#CLASS 0
_________________
If you want to soar with the eagles, don't fly with the turkeys.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net