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
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Mar 18, 2008 3:00 pm   

[2.20] Pattern compiling oddness
 
I've got three triggers to capture my score in three different formats. My triggers weren't firing when I checked my score, and by investigation I found that I could select the first state in each multi-state trigger, go through the compiled pattern, compiled code, and script text tabs to force it each to compile and work. So, I thought something was off in my score triggers. But, separating these three multi-state triggers out and testing them in the untitled session showed that they fired just fine.

When I select the trigger and look at the compiled pattern tab, I see "Error compiling script: illegal character in expression:" (and no character given after that, which seems to be what you'd expect). The bizarre thing is that if I switch to the compiled code tab and then back to the compiled pattern tab, it's compiled successfully!

What I know:

    The problem only seems to occur when I import my 3000+ line script that contains these triggers in it and not when I separate them out.
    The first state of each one contains a variable set to my character's name. Don't know if having a variable in the pattern messes it up or not.



The issues being reported:

    The compiler error doesn't give the illegal character.
    The compiler error seems to be spurious because the pattern will compile by switching tabs and then the trigger works fine.
    The triggers don't compile when imported as part of the larger script. (Makes me wonder what else might not be compiling, honestly.)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Mar 19, 2008 3:28 pm   
 
I think I've narrowed this down to my patterns that have (?:@variable) in them. If I remove the (?:) from the pattern (in the case of single variable patterns), it works. If I leave that in there and just force the pattern/code to compile to switching tabs, it works.

It only happens when combined with variables, as far as I can tell. I've got plenty of triggers that match things like (?:[hH]is|[hH]er) and they work fine.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Mar 19, 2008 8:07 pm   
 
Does the @variable have a value in your settings? If so, does it only cause a problem if @variable has a particular value? If @variable has a null value, then I can see where the PCRE engine might complain about it.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Mar 19, 2008 9:08 pm   
 
The variable has a value before I even define the trigger, assuming the settings are compiled in the order I create them from my script. Would the pattern need to be re-compiled by CMUD when the variable changes?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Mar 19, 2008 10:30 pm   
 
From what I am seeing switching to the Compiled Pattern tab from another trigger tab causes the regex for the trigger to be compiled after it parses through the pattern for any variable references. This particular recompile does not occur if you are examining one trigger after another looking at the compiled pattern tab.

I also tested using an invalid variable reference in a pattern of "(?:@var)" and the PCRE didn't complain with the pattern compiled by CMud correctly. In fact it matched everything as a null pattern should. Creating and changing the variable properly adjusted the matching as well.

The error your mentioning would be before it even tries to compile the regex. I would have to guess this has something to do with your import method, and would suggest you try to put together a procedure that demonstrates it using a smaller snippet of your settings.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Thu Mar 20, 2008 2:40 am   
 
I tried reproducing it with a small script and couldn't make it happen. I imported my one (3,000+ line) script in a blank session, however, and it did happen. I sent the script with instructions to Zugg (support e-mail) hoping he'd be able to reproduce it and figure out the root cause.
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