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


Joined: 10 Dec 2010
Posts: 1

PostPosted: Sun Dec 19, 2010 1:35 am   

Within lines trigger condition pattern
 
I'm having a problem with a trigger condition where the pattern won't fire when I use wildcards or {option1|option2} type variables. If I change the pattern on the condition to a simple text string it fires so I'm guessing there's something wrong with my pattern as opposed to my trigger settings as a whole.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="Tdcleftleg" priority="34890" copy="yes">
    <pattern>^You call upon %w and unleash a forceful blow towards %w's left leg with your trusty staff.$</pattern>
    <value>#IF (@dcleftleg>=4) {dcleftleg=1} {#ADD dcleftleg 1}
#color yellow</value>
    <trigger type="Within Lines" param="1">
      <pattern>^%w {parries the attack with a deft maneuver|twists %w body out of harm's way|dodges nimbly out of the way|quickly jumps back, avoiding the attack}.$</pattern>
      <value>#IF (@dcleftleg>0) {#ADD dcleftleg -1}
#say firing</value>
    </trigger>
  </trigger>
</cmud>


Basically the script is a way of counting damage to an opponent's limbs. It adds to count variable if I hit but when someone parries or dodges the attack (way of defending against damage) then I get my attack message and the following line is an attack failed message which subtracts from the count variable. Also this worked fine in ZMUD so I might have missed fixing something when I transferred to CMUD.
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Sun Dec 19, 2010 2:32 am   
 
Help File: Pattern Matching wrote:
{val1|val2|val3|...} match any of the specified strings can not use other wildcard inside this


The modified trigger and added fails variable below is one of the ways you can do what you want in CMUD. I'll be happy to explain what is going on if needed.

Code:
<trigger name="Tdcleftleg" priority="34890" id="5">
  <pattern>^You call upon %w and unleash a forceful blow towards (%w)'s left leg with your trusty staff.$</pattern>
  <value>#IF (@dcleftleg>=4) {dcleftleg=1} {#ADD dcleftleg 1}
#color yellow</value>
  <trigger type="Within Lines" param="1">
    <pattern>^%w (*).$</pattern>
    <value>#if ((%ismember(%1,%expand(@fails))) AND (@dcleftleg>0)) {#ADD dcleftleg -1}
#say firing</value>
  </trigger>
</trigger>


Code:
<var name="fails" type="StringList" id="8">
  <value>parries the attack with a deft maneuver|dodges nimbly out of the way|quickly jumps back, avoiding the attack|twists %t1 body out of harm's way</value>
  <json>["parries the attack with a deft maneuver","dodges nimbly out of the way","quickly jumps back, avoiding the attack","twists %t1 body out of harm's way"]</json>
</var>
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
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