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
Teleos
Newbie


Joined: 28 Jun 2004
Posts: 9

PostPosted: Wed Jul 07, 2004 6:28 pm   

#SUB and pattern matching
 
Here's how the tells look in Achaea:

You tell Liedia Navarne, Adherent of Light, Sorry...and thanks!
Liedia tells you, You're welcome!

I want to #SUB the first example to look like this:
-> Liedia: Sorry...and thanks!

and the second:
<- Liedia: You're welcome!

I can't figure out how to strip the title after the name (which always comes after "You Tell ") when I send a tell and I can't figure out how to insert the little arrow before name when I recieve a tell. any suggestions?

here's my non-working attempts:
#SUB {^You tell (%w)} {"-> %1"; #CO khaki}
NOTE: I only want %w to match ONE word.

#SUB {^%w tells you,} {"<- "%1 ; #CO khaki}
NOTE: I want to add the arrow before the name on this one

Thanks!!!
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jul 07, 2004 7:17 pm   
 
#TRIGGER {^You tell (%w) *,*,} {#sub -> %1:}
#TRIGGER {^(%w) tells you,} {#sub <- %1:}

Note: for the space between the arrow and the name in the sub pattern, I used ascii 255.

If copy/paste doesn't keep that character, you can re-create it by:
In the sub pattern, hold down <ALT> and key 255 on the numberpad.

For some reason, the parser doesn't like a space or tilde in that particular place.

edit Anchored trigger pattern and tried to better explain that rascally space.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 08, 2004 4:12 am   
 
Probably because #SUB has two forms: If it has two strings following the command it makes a new trigger, using the first string as the pattern and the second string as the substitute text. When you include a space, you are trying to make triggers with patterns of -> and <- which either start or end with unmatched delimiters.

If you want to include spaces in your substitute text, use curly braces! (Actually, it's a good idea to just get in the habit of using curly braces or other delimiters automatically)
#TR {^You tell (%w) *,*,} {#SUB {-~> %1:}}
#TR {^(%w) tells you,} {#SUB {~<- %1:}}
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