Rebounding triggers

by Unknown

Back to Mechanic's Corner.

Unknown2005-01-19 02:21:12
Okay, so I have two triggers for rebounding, in case someone's name gets long:

For the two-line:
#TRIGGER {You suddenly perceive the vague outline of an aura of rebounding around} {}
#COND {(%w).} {#echo %1's rebounding up!} {within|param=1}

Just one:
#TRIGGER {You suddenly perceive the vague outline of an aura of rebounding around (%w).} {#echo %1's rebounding up!}

So, when I see someone's rebounding up (someone with a short name, so it's the one-line), I get:

You suddenly perceive the vague outline of an aura of rebounding around Person.
Person's rebounding up.
up's rebounding up!

I figure this has something to do with one trigger activating on the other, but I'm not sure how to fix it. Help?
Unknown2005-01-19 02:42:12
Try tacking on an end-of-line character ($) to the first state of your first trigger. That will keep it from triggering on both cases and giving you the extra echo.
Dumihru2005-01-19 02:44:33
There might be some mismatch between the output given and the triggers given. From the output (quoted below), the second (1-state) trigger was actually doing this:
#echo %1's rebounding up. (ending with a ".", not a "!").
This would cause the first (2-state) trigger to fire, resulting in:

QUOTE
You suddenly perceive the vague outline of an aura of rebounding around Person.
Person's rebounding up.
up's rebounding up!


So changing the second (1-state) trigger to "#echo %1's rebounding up!", as shown in your post, should fix this.

Another quick fix is to change the first (2-state) trigger to:
CODE
#TRIGGER {You suddenly perceive the vague outline of an aura of rebounding around $} {}
#COND {(%w).} {#echo %1's rebounding up!} {within|param=1}


Or, if you want to combine these into 1 trigger, you can grab the "You suddenly perceive" line plus the succeeding line, then parse the person's name out with %regex() like this:
CODE
#TRIGGER {You suddenly perceive the vague outline of an aura of rebounding around} {#var rebound_msg {%trigger}}
#COND {*} {#var rebound_msg {@rebound_msg %trigger}; #if (%regex(@rebound_msg, "around (+)\\.", rebound_who)) {#echo @rebound_who's rebounding up!}; #unvar rebound_msg; #unvar rebound_who} {within|param=1}

This uses some extra variables though, so you might prefer to stay with two triggers instead.

I didn't test that code by the way, so the syntax might be slightly off.