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
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Feb 03, 2005 11:13 am   

Highlighting text with #CW
 
Another hopefully easy question

I have a variable that highlights any instance of certain items (player names for example). The problem is that when player names appear in the middle of other words then half of those words gets highlighted.

For example.

whoList = {Guinn|Bob|Joe|Sun}
#TR {{@whoList}} {#CW $EEBB66}

If the output is then:

output: Guinn says, "Hello bob, how's life?"
result: Guinn and Bob will be highlighted. Just what I want

output: The sun rises slowly in the east.
result: sun is highlighted - this is wrong, but I know completely unavoidable, since zMud can't tell the context.

output: The ball bobbles on the edge for a moment before falling.
result: 'bob' is highlighted because it's part of bobbling - this is what I want to avoid

I'm guessing it's some sort of matching I need to say that if the match occurs separately then highlight it, but if it's part of another word then don't. Problem is I can't force it to match a space at the start and end of the word, since the name may appear at the beginning, or may have punctuation at the start or end. So... any way to have it match Bob! but not Bobb, or Sun but not Sunday.

Thanks again
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Feb 03, 2005 1:14 pm   
 
#TR {%q{@whoList}%q} {#CW $EEBB66}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Feb 03, 2005 2:41 pm   
 
Perfect, ta
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Feb 04, 2005 12:47 am   
 
Also you can check the case-sensitive option in the Options panel of the Settings Editor. The should eliminate few erronious matches.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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