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


Joined: 01 Feb 2010
Posts: 4

PostPosted: Mon Feb 01, 2010 11:25 am   

Help with #if
 
I have read helpfiles firmly but still dont understand the following


If any of the words before "asks you:" contains "example" I want it to {#cap tells}

Triggerpattern:
xxxxx xxxx xxxx xxx xx xxxx asks you: bla bla bla

Value???


Kind Regards
Plaguelord
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Feb 01, 2010 11:43 am   
 
The number of words before 'asks you:' is never constant? Is the name always before asks, or can it appear anywhere in the combination before asks? You can do it, but it'll be a very greedy matching pattern, meaning it'll match any line that contains "example xxxx asks you: blah blah blah" (i.e. Charneus tells you 'Hahaha... Example asks you: blah blah blah! ROFL' would match).

The reason why I ask is because if it's always either one, two or three words, we can do a regex to check for that and therefore you lessen the likelihood of you capturing errant channels. So, give us some more details and we can craft a better trigger for you.

Charneus
Reply with quote
plaguelord
Newbie


Joined: 01 Feb 2010
Posts: 4

PostPosted: Mon Feb 01, 2010 12:10 pm   
 
1. the words "before asks you" is never constant
2. It can appear anywhere in the combination before asks

If it was, how do I then use regex. I think it would be useful for me in other matters.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Feb 01, 2010 1:24 pm   
 
Regex is a very powerful tool to use. I'll go ahead and use it here just for sake of ease.

First thing you want to do is put your "examples" into variables. I'm assuming there are going to be more than one "example" (like Bob, Joe, Suzy, Lisa, etc.)

#VAR caplist {Bob|Joe|Suzy|Lisa}

should do it.

Next, the trigger.

#REGEX {(?:@caplist)(.+)?asks you: (.+)} {#CAP tells}

That way, whenever the line comes up that contains someone from your caplist variable, it'll capture it to tells. This regex trigger allows for the existence of words after the name, as well. Ergo, it matches the following:

Billy Bob the Great asks you: Are you there?
Suzy asks you: Are you around?
Lisa, a grey enchanter, asks you: What are your wishes?
Big Joe asks you: Yo, you wanna hit up them ladies?

Anyway, hope this helps out!

Charneus
Reply with quote
plaguelord
Newbie


Joined: 01 Feb 2010
Posts: 4

PostPosted: Mon Feb 01, 2010 3:33 pm   
 
thank you so much.
I see that (.+) means "match everything", right? is "." and "+" two different things or is it allways together ".+"

What trigger do I need if I want to #cap lines where the first word in the line is not "the"

example:
I dont wanna #cap:
The big orc asks you: how are you?

I wanna #cap:
A big orc asks you: how are you?
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