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
abeathy
Newbie


Joined: 16 Apr 2013
Posts: 2

PostPosted: Tue Apr 16, 2013 8:45 pm   

Trig pattern help
 
Hi all!

I'll try to be brief and provide all the detail that's needed. Forgive me if my post gets long - I'm truly stumped.

Edit: I'm using CMud 3.34

I have this one big string that I want to make 2 separate triggers out of:
Code:
Giant lets his guard down, and you instantly take advantage by chopping mercilessly at Giant's exposed weapon arm splattering gore and small chunks of flesh! Giant howls in pain as he sees his lifeblood spewing forth from the wounds and laughing cruelly you kick him where it hurts the most.


This big string needs to have 2 triggers associated with it. One trig for the first sentence:
Code:
Giant lets his guard down, and you instantly take advantage by chopping mercilessly at Giant's exposed weapon arm splattering gore and small chunks of flesh!


And one trig for the second sentence:
Code:
Giant howls in pain as he sees his lifeblood spewing forth from the wounds and laughing cruelly you kick him where it hurts the most.


Here are the triggers that I made:
Code:
#trig {* lets * guard down, and you instantly take advantage by chopping mercilessly at *~'s exposed weapon arm splattering gore and small chunks of flesh~!} {#echo CHOP}

Code:
#trig {* howls in pain as * sees * lifeblood spewing forth from the wounds and laughing cruelly you kick * where it hurts the most.} {#echo CHOP OFFHAND}


The first trig goes off when the big string is displayed from the MUD, but the second trig does NOT.

But, when I echo the big string through a channel, the second trig goes off:
Code:

23:04 Abeathy {xmud}: the whole string is -> "Fremen guard lets his guard down, and you instantly take advantage by chopping mercilessly at Fremen guard's exposed weapon arm splattering gore and small chunks of flesh! Fremen guard howls in pain as he sees his lifeblood spewing forth from the wounds and laughing cruelly you kick him where it hurts the most." - but i want a trig that matches just the spot weakness message
CHOP
CHOP OFFHAND <<<<----second trig went off here.


So, my question is - why is cMud recognizing the second trig only when I echo the big string through a channel or a tell? When the big string is displayed from the Mud, the second trig doesn't work.

I tried adding this to the first trig... I thought maybe the "CHOP" echo was messing up the pattern for the second trig, but it didnt work.
Code:
#alarm +1 {#echo CHOP}


Any ideas? Thanks in advance.

-Abe
Reply with quote
abeathy
Newbie


Joined: 16 Apr 2013
Posts: 2

PostPosted: Fri Apr 19, 2013 5:58 pm   
 
Nothing? :(
Is something unclear? Or are there really no other ideas?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Apr 19, 2013 9:02 pm   
 
I see no reason why they wouldn't work.
_________________
EDIT: I didn't like my old signature
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Fri Apr 19, 2013 10:23 pm   
 
MattLofton wrote:
I see no reason why they wouldn't work.


Agreed, they look correct.

My normal first try would be to use regexp triggers.

If that didn't work, I'd use one big trigger with the second piece being optional and check for the second chunk in the script.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 26, 2013 4:40 pm   
 
There are a couple of issues here. Your triggers are written poorly. They should not even be firing when you "echo" them through a channel like that. You should never start a trigger with *.

Second, it's unclear what you are trying to do. Spot what weakness?

Anyway, these triggers below will work fine for you. Additionally, depending on the priority if you created the second trigger first it will echo before the other one. Here I created them in the correct priority order.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="chop" priority="30" regex="true" copy="yes">
    <pattern>^[A-Z][a-z]+ lets h[ie][sr] guard down, and you instantly take advantage by chopping mercilessly at [^\']+\'s exposed weapon arm splattering gore and small chunks of flesh\!</pattern>
    <value>#print "Chop"</value>
  </trigger>
  <trigger name="chopOffhand" priority="40" regex="true" copy="yes">
    <pattern>[A-Z][a-z]+ howls in pain as s?he sees h[ie][sr] lifeblood spewing forth from the wounds and laughing cruelly you kick h[ie][mr] where it hurts the most\.</pattern>
    <value>#print "Chop Offhand"</value>
  </trigger>
</cmud>
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Fri Apr 26, 2013 6:47 pm   
 
oldguy2 wrote:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="chop" priority="30" regex="true" copy="yes">
    <pattern>^[A-Z][a-z]+ lets h[ie][sr] guard down, and you instantly take advantage by chopping mercilessly at [^\']+\'s exposed weapon arm splattering gore and small chunks of flesh\!</pattern>
    <value>#print "Chop"</value>
  </trigger>
  <trigger name="chopOffhand" priority="40" regex="true" copy="yes">
    <pattern>[A-Z][a-z]+ howls in pain as s?he sees h[ie][sr] lifeblood spewing forth from the wounds and laughing cruelly you kick h[ie][mr] where it hurts the most\.</pattern>
    <value>#print "Chop Offhand"</value>
  </trigger>
</cmud>


His example was a two word 'name': "Fremen guard lets his guard down, and you instantly take advantage by chopping mercilessly at Fremen guard's exposed weapon arm splattering gore..."

So, that leading name might have to be [A-Z][a-z ]+ or [A-Z][A-Za-z ]+ if it can be something like "Jim Bob" or "Billy Ray Jim".
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 26, 2013 10:33 pm   
 
I didn't even notice that for some reason. I was looking at the Giant example.

Well really you could remove the anchor I suppose and make it case insensitive. Either use your examples or just use \w+ and it would match on guard.
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