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
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Wed Jun 18, 2003 1:53 am   

^ and $
 

Hi,

^{20|16|12|8|4}$ will prevent the numbers in the brackets from wildly matching (like in 2001, 1160, etc).

The question is why can't I use ^ and $ in a situation like this:

#var fruit {apple|cranberry|peach}
#trigger {^{@fruit}$} {#cw red}

It doesn't work.

If I use

#trigger {{@fruit}} {#cw red}

the words 'cranapple' and 'peachtree' get partially coloured.

I'd like to avoid using spaces at either end because sometimes the mud outputs text like

Peach nectar drips slowly from the broken bottle.

An apple, a peach, and a mixing bowl is on the ground.

And in these two instances spaces won't let the trigger match.

- Ren
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jun 18, 2003 12:03 pm   
 
The ^ tells zMUD to match at the beggining of the line and the $ tells zMUD to match the end of the line. This means that if you surround a pattern with ^ and $, you are telling zMUD to fire the trigger only if the pattern is the only thing in the line.

There is no other way to do what you want except with the spaces. In reality, you need three triggers: one for the start of the line, one for the end of the line, and one for the middle of the line. Try these:
#TRIGGER {^{@fruit}{ |,}} {#CW red}
#TRIGGER { {@fruit}{.|}$} {#CW red}
#TRIGGER { {@fruit}{ |,}} {#CW red}

Kjata
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