Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Rikeshar
Beginner


Joined: 13 Jun 2007
Posts: 11

PostPosted: Mon Feb 08, 2010 11:26 pm   

Prematurely ending multistate triggers.
 
Hey everyone, I'm needing some help with a mulistate state, conditional trigger. Here's the XML for the trigger:

<trigger name="mloss" priority="21960" id="2196">
<pattern>You pluck a twinkling mote from your dreamcatcher.</pattern>
<trigger>
<pattern>You flick a twinkling mote at (%w)</pattern>
<value>#echo !! ATTEMPTING TO BLACK OUT %upper(%1) !!
</value>
</trigger>
<trigger>
<pattern>The mote sinks into {his|her} aura, which darkens with ugly splotches</pattern>
<value>say @tar has blacked out.</value>
</trigger>
</trigger>


Basically, the trigger first looks for: "You pluck a twinkling mote from your dreamcatcher."

When it sees this pattern it moves to the next state and looks for: "You flick a twinkling mote at (%w)"

When it find this, it fires an #echo command and then looks for: "The mote sinks into {his|her} aura, which darkens with ugly splotches" and fires the say.

My issue is that the third pattern does not always follow the second. There's a chance that instead "The mote bounces off {his|her} aura and disintegrates." What I'm trying to do is, should this pattern occur instead of the third condition listed above, for the entire trigger to reset and look for the first pattern again. Any ideas?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Feb 09, 2010 12:16 am   
 
You have (at least) two choices:

1)change the third state's pattern to match and handle both messages.

2)change the third state from Pattern to WithinLines. If the trigger doesn't fire after the appropriate number of lines, the condition will expire and activate the first state automatically.
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Feb 09, 2010 2:34 pm   
 
There is a third choice. You could have a different trigger which watches for "The mote bounces off {his|her} aura and disintegrates." This trigger can manually set the state of the first trigger back to zero, with the #state command.

As an extra subtlety, you could have the second trigger enabled only when it might actually get that line from the mud. This isn't really necessary, but does reduce the number of triggers parsing most lines. It would look something like this:
Code:
<trigger name="mloss" priority="21960" id="2196">
  <pattern>You pluck a twinkling mote from your dreamcatcher.</pattern>
  <trigger>
    <pattern>You flick a twinkling mote at (%w)</pattern>
    <value>#echo !! ATTEMPTING TO BLACK OUT %upper(%1) !!
#t+ mbounces</value>
  </trigger>
  <trigger>
    <pattern>The mote sinks into {his|her} aura, which darkens with ugly splotches</pattern>
    <value>say @tar has blacked out.
#t- mbounces</value>
  </trigger>
</trigger>

And the second trigger would be:
Code:
<trigger name="mbounces" priority="21970" enabled="false" id="2197">
  <pattern>The mote bounces off {his|her} aura and disintegrates.</pattern>
  <value>#state mloss 0
#t- mbounces</value>
</trigger>
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net