Wildcards help

by Shaddus

Back to Mechanic's Corner.

Shaddus2008-12-29 23:52:33
I'm trying to figure out wildcards. How to set them, and such. I'm using Mush, just so you know.


For instance, using %1 as the wildcard, I think that's how it's done;


QUOTE
%1 performs this action.

I would want to automatically

QUOTE
ENEMY %1



I know it's a basic trigger, but I plan on doing a few things, that's just an idea.

Any help out there?

EDIT: Also, a way to let the game wildcard things. For instance, in Aetolia, I was hit with an affliction, and part of the letters were gone. Like-

QUOTE
Your body starts to feel tingly
would be the affliction line.

But instead, I got

QUOTE
Yo*r body star*s to f*el tingly


Is there a way for a system to see past that?
Unknown2008-12-29 23:55:41
QUOTE (Shaddus Mes'ard @ Dec 29 2008, 06:52 PM) <{POST_SNAPBACK}>
I'm trying to figure out wildcards. How to set them, and such. I'm using Mush, just so you know.

For instance, using %1 as the wildcard, I think that's how it's done;

I would want to automatically

I know it's a basic trigger, but I plan on doing a few things, that's just an idea.

Any help out there?


Don't use %1 in the pattern. That goes in the script. Put parentheses around your wildcard to capture it.

(%w) performs this action.
enemy %1
Shaddus2008-12-29 23:57:04
QUOTE (Zarquan @ Dec 29 2008, 05:55 PM) <{POST_SNAPBACK}>
Don't use %1 in the pattern. That goes in the script. Put parentheses around your wildcard to capture it.

(%w) performs this action.
enemy %1

Oh, so why w?

And is 1 used because it's the first wildcard in the triggering phrase?
Esano2008-12-30 00:01:58
w means it's a 'word', ie comprised of letters, numbers, or the underscore character.

%1 is used, yes, because it's the first wildcard in the triggering phrase. If you go on to use full regex you can have wildcards which aren't captured, though.
Unknown2008-12-30 00:16:14
QUOTE (Esano @ Dec 29 2008, 07:01 PM) <{POST_SNAPBACK}>
%1 is used, yes, because it's the first wildcard in the triggering phrase. If you go on to use full regex you can have wildcards which aren't captured, though.


You don't even have to use regex. You could have something like this:

(%w) enters from the %w, wielding (*).

Here %1 would be the first word and %2 would be the last phrase.
Shaddus2008-12-30 00:29:30
QUOTE (Zarquan @ Dec 29 2008, 06:16 PM) <{POST_SNAPBACK}>
You don't even have to use regex. You could have something like this:

(%w) enters from the %w, wielding (*).

Here %1 would be the first word and %2 would be the last phrase.

so, (%w) captures as %1, %w by itself is just a wildcard, and sentence/phrase (*) would capture as %2?
Shaddus2008-12-30 01:23:58
For instance, I have this.



QUOTE
(%w) has entered the area.


And I want it to

QUOTE
CLT1 %1 is in my area


I've tried it, and it doesn't do anything. Is there a box in Mush I should be checking? It says it's enabled.
Unknown2008-12-30 01:30:03
Rule number one about asking for help with scripting: TELL US WHICH CLIENT BEFORE WE ASSUME THE WRONG ONE! tongue.gif

What Esano and I said was for zMUD/CMUD. It's a little different in MUSHclient.

The simple pattern:
CODE
* has entered the area.


The regular expression:
CODE
^(\\w+) has entered the area\\.$


For other info, check out the online help page...
Shaddus2008-12-30 01:32:50
QUOTE (Shaddus Mes'ard @ Dec 29 2008, 05:52 PM) <{POST_SNAPBACK}>
I'm using Mush, just so you know.

tongue.gif
Unknown2008-12-30 01:34:49
You win. It was my fault, assuming the wrong client based on the wrong examples. I'm so used to seeing people use %1 in zMUD patterns... biggrin.gif
Ilyarin2008-12-30 23:05:25
Huh, I read it through and assumed zMUD/cMUD as well. :|