Help with zMUD's Mapper

by Unknown

Back to Mechanic's Corner.

Savash2004-11-15 05:04:44
QUOTE (Zarquan @ Nov 7 2004, 11:28 PM)
Try to avoid using %* in patterns. Zugg said something about it allowing someone to execute commands in your client, though I can't find the post or article because I can't search for a wildcard on his forums. Using * works just fine, anyhow.

Yes. %* has long been an undocumented feature because of it allowing someone else to directly control your zmud, and you should be very very careful of the triggers you use it with. It allows you to capture all characters, even ones that zmud uses internally (such as for commands and variables). The problem is that this allows commands to be embedded in a variable in such a way that when the variable is read the commands are executed.
Thorgal2004-11-17 15:02:07
Not to mention the fact that replacing all the %'s in your patterns with (*)'s, will speed up your system -A BLOODY LOT-. tongue.gif
Unknown2004-11-17 23:08:06
QUOTE (Thorgal @ Nov 18 2004, 04:02 AM)
Not to mention the fact that replacing all the %'s in your patterns with (*)'s, will speed up your system -A BLOODY LOT-. tongue.gif

Does it? So say with the basic prompt trigger:

Would "^(%d)h, (%d)m" be a lot slower than "^(*)h, (*)m"?
Unknown2004-11-18 13:54:13
It's actually faster to use %d, %w, etc., instead of *. All triggers are compiled into regular expressions and run through the same PCRE module internally. Using more specific patterns allows the engine to more easily eliminate a match. Not to mention the fact that the * wildcard will often have the unwanted side effect of matching things you didn't intend.
Thorgal2004-11-21 11:12:25
-shrug- I dunno about any modules, all I know is, I always used %w, %1, %2 etc in patterns, and my system went pretty slow, then I replaced all those with (*), not *, including the prompt, and my system instantly ran 4 times faster. People like Aladraion in Achaea did the same as me, and their experience is identical to mine, -way- faster, ask them!
Unknown2004-11-21 23:56:13
QUOTE (Thorgal @ Nov 22 2004, 12:12 AM)
-shrug- I dunno about any modules, all I know is, I always used %w, %1, %2 etc in patterns, and my system went pretty slow, then I replaced all those with (*), not *, including the prompt, and my system instantly ran 4 times faster. People like Aladraion in Achaea did the same as me, and their experience is identical to mine, -way- faster, ask them!

%1 and %2 etc. will probably make pattern-matching slower, as they are meant to be used for retrieving the other %s from a pattern.

You should use:
- %w to match any word (Bob, test)
- %d to match any number (123, 4)
- * to match anything (abc xyy so, qwerty 12345)
- ? to match any single character (x, 6)
- %n to match a integer (+3, -7)
- %a to match any amount of alphanumeric characters (d45h, testing123)
- %x to match any amount of non-white spaces (sn8f6471yb8, asruh`je)
- %s to match any amount of white spaces ( , )
- %p to match any punctuation ( ", ~)
- to match only the characters within the range

And use () around any of these to save it to %1, %2 -> %99 for scripts.
Unknown2004-11-22 11:05:24
Oo, I've questions.. I use (%w) and %w in my trigger patterns, and %1 and %2 to define some of them in #IF's.

Question 1:

Do the ( ) being around the %w have any real beneficial or negative outcome?

Question 2:

Does it effect the speed processing or any outcome using %1 to define the %w, %d, or whathave you matched in the trigger pattern?
Drago2004-11-22 13:08:23
I've always thought putting %w rather then (%w) means you can't refer to it as %1 within the trigger. So say..
CODE
#TRIGGER {You see (%w) say something, but {his|her} voice is drowned out by the wind.} {tell %1 wind}
As opposed to
CODE
#TRIGGER {You see %w say something, but {his|her} voice is drowned out by the wind.} {tell %1 wind}
Shihsou2004-12-29 00:56:53
I found a reference to %* in the helpfiles. Look at #ONINPUT, and it talks about it in the second example.