|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Jan 21, 2010 3:58 am
Multiple triggers with one common command. Help eliminate command spam. |
I've come across a situation dealing with a few different triggers with one command in common, that has stopped me dead in my tracks and I was hoping I could get a little help from some you you guys. What would be the best way to accomplish what I have below?
PatternA matches = DoCommandA;DoCommandC
PatternB matches = DoCommandB;DoCommandC
PatternC matches = DoCommandC
everything is going ok up till now, here is where I am stumbling.
A match of either PatternA or PatternB followed by PatternC on the very next line sends DoCommandC twice. How should I go about having DoCommandC only sent once in a case like this?
PatternC is a exact match trigger that never changes. PatternA and PatternB are setup to only match the first few words of the line then use wildcards to pull the rest of the pattern (a combination of words that would make a fairly large list) out and use in DoCommandA or DoCommandB.
Sorry to sound so cryptic but it was easier for me to follow what I was doing this way. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Jan 21, 2010 6:03 am |
Stop being cryptic and use real examples of real mud text with real commands you want to use when real triggers match those examples.
The answer you get is going to be highly dependant on those real things. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Jan 21, 2010 6:22 am |
Real examples should make no difference in this situation. I'm not asking for all the work to be done just a little guidance pointing me in the right direction. But following the format listed above here would be an example.
I am an awesome %1.(PatternA) = #send 'I am awesome %1.;#send pat self
I am great %1.(PatternB) = #send 'I am great %1.;#send pat self
I deserve a pat on the back.(PatternC) = #send pat self
There are you examples. No they are not exact mud text because I don't have and exact list to copy and paste. I only want #send pat self to be sent once if the mud output is as follows.
<prompt>
I am an awesome %1.
I deserve a pat on the back.
<prompt> |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Jan 21, 2010 6:49 am |
multi-state trigger. Awesome being the first pattern, back pat being the second pattern.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Sir5er Beginner
Joined: 21 Aug 2009 Posts: 11
|
Posted: Thu Jan 21, 2010 7:14 am |
I agree, first state of the the trigger will send the command then store the fact that you've patted yourself in a variable, second state matches the next line ^(*)$ then something like
#if (@pattedSelf)
{
pattedSelf = ""
}
{
#if (%1 = "I deserve a pat on the back")
{
pat self
}
} |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Jan 21, 2010 11:15 am |
Thanks for the help guys I passed over multistate triggers at first, because I figured the separate trigger for PatternC would then still cause DoCommandC to fire twice. After a bit of trial and error, priority switching and variable checks, I believe I have a winner. It seems to work well so far anyway. All the new functions and commands in CMUD are so cool, even if i only know how to use about 25% of them right now.
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
|
|