 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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:
in CMUD:
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... ;) |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: 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. |
|
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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... ;) |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: 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. |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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 :)
|
|
|
|
 |
|
|
|