[MudWalker] triggers?

Kevin Reid kpreid
Tue Jun 7 17:11:07 PDT 2005


On Jun 7, 2005, at 19:16, aaron wallace wrote:

> So this is a pretty basic question, I suppose. I want
> a trigger to capture the second word of the string
>
>      xxx attacks yyy
>
> I don't care what happens to the first word and that
> is always one word.
>
> if I could I would like to use the second string which
> can be more then one word: i.e. royal guard
>
> so my dream trigger is xxx attacks yyy
>
> fires the trigger which is
>  use strike to injure at yyy

Write the trigger as:

   Match:
     ^\S+ attacks (.*)$

   Script:
     use strike to injure at $$arg[1]


Explanation:

The ^ and $ indicate that what is between them must be the entire line.

\S+ matches one or more characters which are not space - that is, a 
single word.

.* matches any text.

(.*) puts that text in arg[1]. Further parentheses go into arg[2], etc.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the MudWalker mailing list