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
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Wed Dec 12, 2007 10:13 am   

trigger patterns
 
This is what i want to trigger on:
Fhqwhgad tells you 'hello there'
My trigger looks like this: %w tells you '*'
It works great and all, however it isn't as picky as i'd like. It triggers even if something is infront of the %w which i would like it not to.
Example: The Fhqwhgad tells you 'hello there'
Basically i want it to trigger when there's only 1 word before the tells you.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Dec 12, 2007 11:24 am   
 
This process is sometimes called anchoring. The ^ character matches the start of the line, so ^hello in a trigger will only match the world "hello" when it's at the beginning of the line. Similarly, $ matches the end of the line.

Your new trigger pattern will be ^%w tells you '*'

For more info on pattern-matching, see the help.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Wed Dec 12, 2007 2:11 pm   
 
This can however miss some things when they appear AFTER your prompt (due to repeated command inputs and such).
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Dec 13, 2007 12:00 am   
 
One workaround, which is really only possible if there is no chance of extra wordage in front of or behind a player name, is the following:

#trigger {^(*) tells you, '*'$} {#if (%numwords(%1) = 1) {#noop this is a valid tell from a player} {#noop this is an invalid tell}}
_________________
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