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


Joined: 05 Feb 2002
Posts: 13
Location: United Kingdom

PostPosted: Fri Feb 13, 2004 1:02 pm   

Checking text for certain words
 
Hi,

I'd like to create a trigger that will check a line of text for particular words. The words are ward and weapon. If the line contains any of these words I'd like to reply to the person "Alas I have not studied that weave yet."

The input looks like Person tells you 'Can you ward weapons?'.

So far I have created a trigger with a temp variable for the person who asks me this question. I have also created a variable to contain the text of the whole line that I receive.

The next part has me a little stuck. Should I use an IF statement to check if the text contains ward or weapon? Am I even going the right way about this?

Any help would be most appreciated.
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Fri Feb 13, 2004 1:29 pm   
 
You could do something like this

#trig {^(*) tells you 'Can you ({@wordcheck})*} {tell %1 "Alas I have not studied that weave yet."}

The persons name is stored in the %1 parameter and the actual word that is matched is stored in the %2 parameter.

So you could change the tell part to %1 "Alas i have not studied %2 weave yet"

The variable wordcheck is a string list that can contain any number of words you would like to watch out for. Each one is seperated by |.

i.e ward weapon|another skill|another skill and so on

Hope this helps

mortie
Reply with quote
Karnie
Beginner


Joined: 05 Feb 2002
Posts: 13
Location: United Kingdom

PostPosted: Fri Feb 20, 2004 8:31 pm   
 
Sorry about the late reply. It works great. Thanks a lot. :)

Karnie
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