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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Rikeshar
Beginner


Joined: 13 Jun 2007
Posts: 11

PostPosted: Wed Jun 13, 2007 8:46 pm   

Isolating for triggers
 
okay, got one more question, again, probably an easy one...

I'm trying to highlight names, by making a trigger with the name as the pattern, what I'd like to know is how to isolate just what enter as the pattern to be highlighted.

What I'm getting now is, for instance, if I use "Tota" as the pattern, it will highlight the "tota" in "total" as well, where I just want it to highlight the Tota on its own.

Any ideas? I tried adding a "~" before it, but that doesn't seem to work.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Jun 13, 2007 11:11 pm   
 
If it's always at the beginning of a line you can try using the '^' to mark the beginning of a line.

A better approach though would be to change the trigger to be a regex type and use "\bTota\b" as your pattern. The '\b' is a word delimiter.
_________________
Asati di tempari!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jun 14, 2007 4:17 am   
 
Use the %q wildcard. Think it might work similar to \b in regex, but not sure if it's identical in behavior. Zugg doesn't do any code magic on the regex codes themselves, he just hands them off to the PERL dll library like a hot potato. Zscript wildcards and stuff, however, he has complete control of so he can do many more things that expand the regex behavior.
_________________
EDIT: I didn't like my old signature
Reply with quote
Rikeshar
Beginner


Joined: 13 Jun 2007
Posts: 11

PostPosted: Thu Jun 14, 2007 10:41 pm   
 
Well, the /b thing didn't work. I haven't tried "^" yet, but I'm not sure that would work either, what if it's at the end? To use the same example "Tota" highlights in "Total" I want it to just highlight the "tota" part. How would I use the %q?
Reply with quote
Yamabushi
Apprentice


Joined: 29 Jul 2003
Posts: 101
Location: USA

PostPosted: Thu Jun 14, 2007 11:07 pm   
 
make sure you use \b instead of /b, there is a difference.
_________________
Yama
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Jun 14, 2007 11:08 pm   
 
The reason it didn't work is because it's "\b" and not "/b".
_________________
Asati di tempari!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jun 15, 2007 1:36 am   
 
Quote:

How would I use the %q?


Just like \b:

%qTota%q

The above also takes care of the ^ and $ anchor characters. These are used to specify the beginning of the line (^) and the end of the line ($), like so:

^This is Tota, she lives in a van, down by the river.$
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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