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


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue Dec 05, 2006 9:41 am   

[1.19] Extra spaces included in (*) matches
 
From another topic where someone wanted to alias [ but couldn't, so I suggested an oninput. It works fine, but CMUD inserts a space at the start of %1 where there shouldn't be

#ONINPUT {^[ (*)} {backstab %1}

if you type [ test
in zMUD:
Code:
backstab test

in CMUD:
Code:
backstab  test


So CMUD is grabbing a leading space to include in the (*) match when it shouldn't be
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Dec 05, 2006 9:46 pm   
 
I could not reproduce this.

Your command:

#ONINPUT {^[ (*)} {backstab %1}

gives an syntax error when I enter it into the command line. This is because the [ character is used in trigger patterns for character ranges. So I changed it and entered this instead:

#ONINPUT {^~[ (*)} {backstab %1}

which doesn't give any syntax error. And now when I enter

[ test

on the command line it gives "backstab test" with only one space. Make sure you had a space after the [ character in the pattern, and make sure it is escaped with ~ or else it's not a valid pattern.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Wed Dec 06, 2006 2:22 am   
 
Odd, it works fine now. I'm certain it was adding the extra space before. Apologies
Btw, the pattern works without the ~ if you use it in the settings editor rather than create from the command line
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Dec 06, 2006 5:49 pm   
 
Quote:
Btw, the pattern works without the ~ if you use it in the settings editor rather than create from the command line


It might be flaky though. Remember that there is a conversion from zMUD trigger pattern syntax into regular expression syntax. Since the [ character is used to start a character substring, I don't actually know if it gets properly converted to RegEx or not. And then I don't know what the Perl RegEx parser actually does with it.

Since we can't really see inside the guts of the Perl RegEx parser, it's possible that your pattern will trigger on something that you don't intend it to.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Dec 06, 2006 6:00 pm   
 
I always wondered why we needed to quote out special characters that aren't used for anything in trigger patterns. Now I know :)
_________________
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 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