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
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Nov 03, 2007 11:17 am   

[2.10] About pattern syntax in triggers
 
After reading this: http://forums.zuggsoft.com/forums/viewtopic.php?t=28715
I've found some strange behavior of the editor.
As I understand, editor does not check pattern syntax (not script syntax!) in Script Text tab, because now it allows do the following:

Pattern:
You are {really hungry.|hungry.|feeling slightly hungry.

Editor says that it can't compile this pattern (check Compiled Pattern tab), but not everybody check this and the trigger still fires normally.
You can see that regex adds closing parenthesis automatically by converting to regex or switching to Test Pattern tab. I believe that it would be better not to add silently missing parenthesis or brace, but tell user that he'd wrote something wrong and do not execute trigger script. You can't be sure what user forgot to type in the pattern field, only the closing brace or a part of expression. This is not the case when you should "auto do" something.
Reply with quote
Tech
GURU


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

PostPosted: Sun Nov 04, 2007 8:13 am   
 
I did some quick testing on it, and the trigger doesn't actually work.

If you try to get it to fire from the command line nothing happens. Now that I think about it though, I think your point may be that the 'Test Pattern' may be misleading, and in that case you are right.
_________________
Asati di tempari!
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sun Nov 04, 2007 9:58 am   
 
1) Start CMUD, hit Esc
2) In the editor create a new pattern trigger with pattern
Code:
You are {really hungry.|hungry.|feeling slightly hungry.

and script
Code:
#SAY I can see this

3) Enter at cmd line
Code:
#SHOW You are hungry.


Output:
You are hungry.
I can see this

This works only in editor, because #TRIGGER command will naturally give you the parsing error "unmatched braces". That why I said that the editor does not check pattern syntax as hard as command line parser does.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Tech
GURU


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

PostPosted: Sun Nov 04, 2007 1:48 pm   
 
I did my check in the editor as well, but I will give it another shot.
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Nov 05, 2007 6:02 pm   
 
With trigger patterns, if they do not compile, then CMUD treats then as a literal string and passes the value to the RegEx converter "as-is". This was done to allow some triggers from zMUD that don't compile to still work in many cases.

So yes, the editor doesn't check the pattern syntax unless you click the "Compiled Pattern" tab, and triggers are still enabled/executed even if the pattern doesn't compile.

If you run the Compatibility Report, it will tell you which patterns don't compile.
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