|
undergod Wanderer
Joined: 27 Jun 2001 Posts: 82
|
Posted: Tue Nov 27, 2001 8:38 am
Highlighting problems |
Okay, I know I post here a lot, hehe. But, I try and do a lot with ZMud.. push the limits, ya know? Anywho...
I'm trying to highlight some words... so, i have a trigger like this:
#var words word1|word2|word3
#trigger {@words} {#CW 132}
But... it highlights everything that contains one of those words too... how do I make it highlight that word only when it is surrounded by whitespace? |
|
|
|
Tolpan Beginner
Joined: 07 Nov 2000 Posts: 23 Location: Germany
|
Posted: Tue Nov 27, 2001 9:16 am |
You should tell us your version of zMud. I am using the
6.22 beta and for me the trigger #trigger {@words} {#CW 132}
only matches strings like "word1|word2|word3" but NOT single
words out of the list.
To match single words out of the list I have to set up the
trigger like:
#trigger {{@words}} {#CW 132}
However to solve your problem you need to redefine your words
with surrounding spaces, like:
"#var words Xword1X|Xword2X|Xword3X"
(chars X must be spaces)
Works for me |
|
|
|
undergod Wanderer
Joined: 27 Jun 2001 Posts: 82
|
Posted: Tue Nov 27, 2001 7:06 pm |
I using 4.62 right now, but will be upgrading as soon as I can figure out how to transfer all my settings, hehe.
word1|word2|word3 etc.. matches single words AND any words containing those strings... I think the Xword1X|Xword2X|Xword3X etc.. thing will work, thanks a lot. |
|
|
|
undergod Wanderer
Joined: 27 Jun 2001 Posts: 82
|
Posted: Tue Nov 27, 2001 8:17 pm |
Okay, woot... I decided to blow the budget and get 6.16...
but, I'm still having that problem... and I can't use that Xword1X (where X is a space) because I want to match the word if it is at the beginning or end of a line, too. Anyone help? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Nov 28, 2001 2:05 am |
The best I can come up with is multiple triggers:
#CW {^word1 }
#CW {^word1,}
#CW {^word1:}
#CW { word1 }
#CW { word1,}
#CW { word1.}
#CW { word1:}
etc.
You might be able to combine some or all of these into a stringlist.
LightBulb |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Nov 28, 2001 3:12 am |
quote:
Okay, I know I post here a lot, hehe. But, I try and do a lot with ZMud.. push the limits, ya know? Anywho...
I'm trying to highlight some words... so, i have a trigger like this:
#var words word1|word2|word3
#trigger {@words} {#CW 132}
But... it highlights everything that contains one of those words too... how do I make it highlight that word only when it is surrounded by whitespace?
First define your variable as normal (no spaces). Second, create three triggers, like thus:
#trigger {^{@word}%s} {}
#trigger {%s{@word}%s} {}
#trigger {%s{@word}$} {}
That should cover you if you didn't want to use what Lightbulb wrote.
li'l shmoe of Dragon's Gate MUD |
|
|
|
undergod Wanderer
Joined: 27 Jun 2001 Posts: 82
|
Posted: Wed Nov 28, 2001 5:30 am |
quote:
#trigger {^{@word}%s} {}
#trigger {%s{@word}%s} {}
#trigger {%s{@word}$} {}
So, the first one covers me for start of a line and space following.. second is the word with spaces on both sides.. and the third is the word with space before and end of the line after?
Sorry bout this least post.. I just want to learn from this and not just write it down, hehe |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Nov 28, 2001 6:09 am |
quote:
quote:
#trigger {^{@word}%s} {}
#trigger {%s{@word}%s} {}
#trigger {%s{@word}$} {}
So, the first one covers me for start of a line and space following.. second is the word with spaces on both sides.. and the third is the word with space before and end of the line after?
Sorry bout this least post.. I just want to learn from this and not just write it down, hehe
Yep. That's it exactly. I didn't handle punctuation, though. If you need to handle it, you can perhaps combine the mid-line and end-line triggers like so:
#trigger {%s({@word})(%*)$} {#sub {" "%ansi(word_color_attributes)%1 %ansi(default_color_attributes)%2}}
This trigger allows you to insert the color highlight for what you wished (@word), but you also have to take care of anything that might follow the @word match since this trigger is not anchored on a border of @word.
li'l shmoe of Dragon's Gate MUD |
|
|
|
undergod Wanderer
Joined: 27 Jun 2001 Posts: 82
|
Posted: Thu Nov 29, 2001 1:54 am |
I handled punctuation by using
%s{@word}%p
It highlights the punctuation afterwards, but it's not too bad |
|
|
|
|
|