|
hermz Newbie
Joined: 16 Aug 2010 Posts: 3 Location: Western Australia
|
Posted: Mon Aug 16, 2010 2:46 pm
Problem using Within Lines in multi-state trigger |
Hi there,
I'm trying to create a simple, multi-state trigger that only fires a specific command if the line received immediately afterwards matches. The problem is that the below trigger is firing even if the line is matched within 2 lines, despite the code specifically stating to only match within 1 line.
Code: |
<trigger name="EatTrig" priority="15300">
<pattern>^You eat a herb.$</pattern>
<value></value>
<trigger type="Within Lines" param="1" newline="false" prompt="true">
<pattern>^(%d)h, (%d)m (*)-</pattern>
<value>#ECHO IT WORKED</value>
</trigger>
</trigger>
</cmud> |
So using the above code, the following text from the MUD will cause it to fire (which is good!):
Code: |
You eat a herb.
5291h, 4033m ex-IT WORKED |
However, for some reason I can't understand, the following text from the MUD is also causing it to fire (bad!):
Code: |
You eat a herb.
Another line is here.
5291h, 4022m ex-IT WORKED |
Could somebody please tell me what I'm doing wrong here? Is triggering on prompt in multi-state triggers a no-no for some reason? I know there are other ways to achieve the same result, however I'd prefer to use multi-state triggers and I'm really eager to find out why it's firing within 2 lines instead of 1.
Thanks,
Hermz |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Aug 16, 2010 6:04 pm |
Why does this need to trigger on prompt? It looks like this should be a trigger on newline. That could very well be the problem, as you have guessed. Is there a reason you want it to trigger on prompt?
|
|
|
|
hermz Newbie
Joined: 16 Aug 2010 Posts: 3 Location: Western Australia
|
Posted: Tue Aug 17, 2010 12:22 am |
I has to trigger on prompt because the second pattern it needs to match is the prompt from the MUD.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Aug 17, 2010 1:36 am |
Being that this is in 2.37, I'd bet this is a really old bug that was noticed and fixed early in the 3.xx beta cycle. I think CMud has a %line/%line2/%line3 sequence of variables you could check that would basically do what Within Lines does, as a workaround.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
hermz Newbie
Joined: 16 Aug 2010 Posts: 3 Location: Western Australia
|
Posted: Tue Aug 17, 2010 1:57 am |
MattLofton wrote: |
Being that this is in 2.37, I'd bet this is a really old bug that was noticed and fixed early in the 3.xx beta cycle. I think CMud has a %line/%line2/%line3 sequence of variables you could check that would basically do what Within Lines does, as a workaround. |
Yeah, I'm using %line2 as a workaround at the moment. Couldn't find any specific mention of this problem being addressed in any of the version history |
|
|
|
|
|