|
bodhi Newbie
Joined: 04 Nov 2002 Posts: 3
|
Posted: Mon Nov 04, 2002 2:56 am
Pattern matching lists |
I've searched through the forums and I can't seem to find the answer to my question..
Here's my situation.. I'm trying to develop a trigger that will fire on seeing an item, with a list of possible "states" next to the item.. For instance..
A short staff
A short staff.
A short staff (in hands).
A short staff (wielded).
etc..
So the list I created is...
A short staff{.| (in hands)| (wielded)}
...and its worked great. I've tried sticking about everything I can think of in there to account for the case where there is nothing after my item, (A short staff), with no luck. Any suggestions?
Thanks |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Nov 04, 2002 3:00 am |
can there ever be multiple states for an item? For example:
A short staff (wielded, featherfall).
If not, then this should work:
#trigger {A short staff(*)} {}
li'l shmoe of Dragon's Gate MUD |
|
|
|
bodhi Newbie
Joined: 04 Nov 2002 Posts: 3
|
Posted: Mon Nov 04, 2002 3:06 am |
The reason I have to lay out each case specifically is because in my highly-customized LPmud, I'm using #SUB to replace when I see an item with the item + its stats. For instance..
A short staff (wielded)
...becomes...
A short staff (wielded) (5/5/0) <- thats +aim/+attack/durability on my mud
Believe me, using #SUB in these cases - if I'm not specific it substitutes things in where I don't want them, or it won't when I do. Here's the complete list I'm using right now..
{.| (wielded).| (in hands).| (worn).| (open)| (open) (worn).| (open) (in hands).| (closed)| (closed) (worn).| (closed) (in hands).}
I know, crazy mud.. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Nov 04, 2002 6:30 am |
#TR {A short staff$}
It doesn't HAVE to be in the same trigger with everything else.
LightBulb
Senior Member |
|
|
|
Lalaynya Wanderer
Joined: 23 Aug 2002 Posts: 96
|
Posted: Mon Nov 04, 2002 5:12 pm |
A short staff{.| (in hands)| (wielded)|}
That will work! |
|
|
|
bodhi Newbie
Joined: 04 Nov 2002 Posts: 3
|
Posted: Tue Nov 05, 2002 12:33 am |
I tried that. Didn't work. However, I figured out a way to do it by changing my syntax a bit.
Thanks everyone. |
|
|
|
Lalaynya Wanderer
Joined: 23 Aug 2002 Posts: 96
|
Posted: Tue Nov 05, 2002 12:54 am |
quote:
I tried that. Didn't work. However, I figured out a way to do it by changing my syntax a bit.
Thanks everyone.
*boggle*
I use that exact syntax all the time, for capturing tells... I want it anchored at the beginning of the line, but it may or may not have flags in front of it, so I use a list, including the empty last one, to show no flags. Works great. |
|
|
|
|
|