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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Asilient_1
Apprentice


Joined: 26 Apr 2007
Posts: 113

PostPosted: Fri Nov 30, 2007 5:29 am   

[2.13] Similar triggers being an annoyance.
 
Code:
<trigger priority="40" newline="false" prompt="true" id="391">
  <pattern>^H:%d M:%d E:%d ~<(%x) (%w)~>$</pattern>
  <value>#SWITCH (%1="eb") {#VARIABLE equilibrium 0;#VARIABLE balance 0} (%1="-b") {#VARIABLE equilibrium 1;#VARIABLE balance 0} (%1="e-") {#VARIABLE equilibrium 0;#VARIABLE balance 1} (%1="--") {#VARIABLE equilibrium 1;#VARIABLE balance 1}
#IF (%pos(b,%2)) {#VARIABLE blind 1} {#VARIABLE blind 0}
#IF (%pos(d,%2)) {#VARIABLE deaf 1} {#VARIABLE deaf 0}
#IF (%pos(p,%2)) {#VARIABLE prone 1;#SAYP ~<~~>} {#VARIABLE prone 0}
#SAY fired</value>
</trigger>


Code:
trigger priority="80" newline="false" prompt="true" id="8">
  <pattern>^H:(%d) M:(%d) E:%d ~<*~> $</pattern>
  <value>#SAYP %ansi(8)~<%ansi(green)%time(hh:mm:ss:zz)%ansi(8)~>
#VARIABLE curhealth %1
#VARIABLE curmana %2
sipping
</value>
</trigger>


The first trigger -never- fires against..
Code:

H:202 M:216 E:910 <eb d>


However, the second always does. As you can (probably) see, I've tried playing with priorities a little, but have little idea what's causing one to fire and the other not, when both should be firing at the same time. (right?)

I've tested the pattern against the test trigger tab with a perfect match. So that leaves me to believe that having two prompt triggers for the same/similar patterns makes Cmud ignore one. I've tested with another trigger:

Code:
<trigger priority="4070" id="407">
  <pattern>^You have recovered balance.$</pattern>
  <value>#IF (@prone=1 AND @aeon=0) {#SEND {stand}}
</value>
</trigger>


Code:

<trigger priority="3100" id="310">
  <pattern>^You have recovered balance.$</pattern>
  <value>#CO 6
#SWITCH (@ratskilled < 3 AND @ratting="on") {attackrat} (@ratskilled=3) {#REPEAT @ratskilled {get rat};#VARIABLE ratskilled 0}</value>
</trigger>


Those two triggers work fine. It colors/tries to stand if I'm registered as "prone" on the same line. I am inclined to believe this is a problem with prompt triggers. Anyone else seen anything similar?
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Fri Nov 30, 2007 7:04 am   
 
There's a difference between the two patterns:
Code:
<pattern>^H:%d M:%d E:%d ~<(%x) (%w)~>$</pattern>

Code:
<pattern>^H:(%d) M:(%d) E:%d ~<*~> $</pattern>

Note that in the first, the pattern ends with "~>$" and in the second with "~> $". There's a space between the ">" and the "$". So that means the two can never fire on the same line. Either there is a space there, or not.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Nov 30, 2007 1:41 pm   
 
When you make the trigger fire on prompt and not newline, you don't want to use the $ to anchor the pattern. There isn't a newline until more text comes in, so the $ doesn't make sense (in my experience, at least). Try removing that (and any trailing spaces), and see if you get it to fire then.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Nov 30, 2007 7:03 pm   
 
I pondered that myself, but $ doesn't just match a newline, it matches the end of the string, and since when the line is processed for triggers, it ends at the end of the prompt, the $ character should still match.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Nov 30, 2007 7:09 pm   
 
Fang is correct. $ matches the "end of string" normally. It only matches a newline if there is text following the $ in your pattern.

But certainly the issue of whether there should be a space *before* the $ is the problem with the original post.
Reply with quote
Asilient_1
Apprentice


Joined: 26 Apr 2007
Posts: 113

PostPosted: Fri Nov 30, 2007 8:28 pm   
 
Uh. I didn't notice the rogue space. I could've sworn I made both triggers virtually the same. I'll check the spacing problem when I get chance to.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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