|
Penance Newbie
Joined: 10 Jan 2002 Posts: 5 Location: USA
|
Posted: Thu Jan 10, 2002 10:20 pm
Need help trigger and variable. |
I need to match this string, but also keep it from being matched when the line begins with "you" while also saving the 1st word as a variable. Here is what I have:
^{^You} * you.$
I want to trip the trigger whenever someone does something to me. The syntax of the MUD makes it so it's almost always "Guy kicks you." or "Guy laughs at you." However, I *don't* want to trip it when I receive something like "You notice a guy sneaking by you." However, for my purposes I also need to capture the 1st word so %1="Guy". I tried
^({^You}) * you.$
but that produces a recursively smaller list of variables and it's impossible to know which one is the 1st word because lines can be any length.
(it outputs
%1Guy kicks you.
%2Guy kicks you
%3Guy kicks yo
%4Guy kicks y
etc...)
thanks. |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Thu Jan 10, 2002 10:23 pm |
Try this:
#trigger {^(%w) * you.} {#if (%1!=You) {#var enemy %1}}
Iljhar |
|
|
|
Penance Newbie
Joined: 10 Jan 2002 Posts: 5 Location: USA
|
Posted: Thu Jan 10, 2002 10:58 pm |
awesome, I got it working. One more thing, is there a way to check %1 against more then 1 string? For example, could I check to make sure it's not equal to "you" or "a"?
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Jan 11, 2002 12:18 am |
Yes, use the and operator:
#TRIGGER {^(%w) * you.} {#IF ((%1 != "You") and (%1 != "A")) {#VAR enemy %1}}
Kjata |
|
|
|
|
|