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


Joined: 19 Oct 2010
Posts: 4

PostPosted: Tue Oct 19, 2010 5:56 pm   

Error in Autosipper with new version
 
This trigger worked fine before I upgraded to the new CMUD version. Now..

I get this error at every prompt:

Code:
ERROR: Trigger "^(?pval.health:\d+)h, (?pval.mana:\d+)m, (?pval.endurance:\d+)e, (?pval.willpower:\d+)w [exbkdc@]*\-$" fired but did not compile


From this trigger:

PATTERN
Code:
^(?pval.health:\d+)h, (?pval.mana:\d+)m, (?pval.endurance:\d+)e, (?pval.willpower:\d+)w [exbkdc@]*\-$


TRIGGER
Code:
#if (@hmtrack=1) {#if (@pval.healthcheck!=%1 OR @pval.manacheck!=%2) {#sayp %ansi( 7)~[;#if (@pval.healthcheck!=%1) {#sayp %ansi( %if( %1<@pval.healthcheck, 12, 10))%if( @pval.healthcheck<%1, +)%eval( %1-@pval.healthcheck)h};#if (@pval.healthcheck!=%1 AND @pval.manacheck!=%2) {#sayp " "};#if (@pval.manacheck!=%2) {#sayp %ansi( %if( %2<@pval.manacheck, 12, 10))%if( @pval.manacheck<%2, +)%eval( %2-@pval.manacheck)m};#sayp %ansi( 7)~]}};pval.healthcheck=%1;pval.manacheck=%2;#if (@hmhealing=1) {checkhm}


Any ideas on why it worked before and not with the new version? Or how to fix it?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Oct 19, 2010 7:14 pm   
 
The short answer is that the "+" sign is a special character and must be quoted in the context you are using it. In general, your code will be easier to follow and debug if it's properly indented. Finally, if you press Ctrl-K while editing it will (attempt) take you to the location of the error preventing compilation.

Here is version of the code that compiles, you may copy it to you package editor.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="10" copy="yes">
    <pattern>^(?pval.health:\d+)h, (?pval.mana:\d+)m, (?pval.endurance:\d+)e, (?pval.willpower:\d+)w [exbkdc@]*\-$</pattern>
    <value>#if (@hmtrack=1)
{
  #if (@pval.healthcheck!=%1 OR @pval.manacheck!=%2)
  {
    #sayp %ansi( 7)~[;
    #if (@pval.healthcheck!=%1)
    {
      #sayp %ansi( %if( %1<@pval.healthcheck, 12, 10))%if( @pval.healthcheck<%1, "+")%eval( %1-@pval.healthcheck)h
    };
    #if (@pval.healthcheck!=%1 AND @pval.manacheck!=%2)
    {
      #sayp " "
    };
    #if (@pval.manacheck!=%2)
    {
      #sayp %ansi( %if( %2<@pval.manacheck, 12, 10))%if( @pval.manacheck<%2, "+")%eval( %2-@pval.manacheck)m
    };
    #sayp %ansi( 7)~]
  }
};
  pval.healthcheck=%1;
  pval.manacheck=%2;
  #if (@hmhealing=1) {checkhm}</value>
  </trigger>
</cmud>
_________________
Asati di tempari!
Reply with quote
Vrah
Newbie


Joined: 19 Oct 2010
Posts: 4

PostPosted: Tue Oct 19, 2010 8:09 pm   
 
Thank you, works fine again and the help is much appreciated!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Oct 20, 2010 1:42 am   
 
As a general rule, if you are looking for a string (ie, literally the plus sign) you should surround that with ""
_________________
EDIT: I didn't like my old signature
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