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
Thinjon100
Apprentice


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: Thu Jun 07, 2007 11:32 pm   

Having issues with a regex trigger
 
I'm not sure what's going on here... I've been having all sorts of issues with CMud that nobody else seems to have, and even re-installing doesn't seem to clear things up... my latest headache is a simple trigger attempting to capture variables from my battle prompt.

I have a trigger that captures my regular prompt which works perfectly, its pattern is:
Code:

\[Prompt: (\d+)/(\d+) (\d+)/(\d+) (\d+)/(\d+) (\d+)\|(\d+)\|(-?\d+) _([^_]+)_ (\d+)|(\d+)? (\sLdr: \d+)?$

It is, of course, flagged for regex, and it saves the numeric values to variables and works perfectly.

My battle prompt is slightly different, starting with "[BPrompt: " followed by more numbers I want to capture.

It seems no matter what I do, I cannot get the trigger pattern to work... I've even reduced it down to simply
Code:

\[BPrompt

and it won't trigger on my bprompt... even #ECHO [Bprompt won't trigger it... I don't understand the problem.

If I remove the "\[" from the trigger it at least fires, but that's part of the pattern I need it to match, and it works in the regular prompt trigger, so I cannot figure out what the problem is.

I really like a lot of the upgrades in CMud, but the unexplainable oddities and bugs make it a headache at times :(
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jun 08, 2007 12:41 am   
 
There's definitely a bug here involving unmatched but quoted square brackets. I'm not sure if this has been reported already, I have a tickling of a memory about it. It's even more fundamental than your problem:

Code:
#regex {\[} {#echo test}

will never fire except in one specific case. The compiled pattern is this:

Code:
0000   LINE   0   ; \[
0012   STR   '\[]'

which seems in error to me - an extra, closing bracket has appeared at the end. Echoing "[]" will set off the trigger, but no other pattern will. You can work around this for now by enclosing the quoted square bracket in square brackets, creating a range of only one character. Your pattern will look like this:

Code:
[\[]BPrompt

which is harder to read but which should work for now.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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