|
Zene Beginner
Joined: 10 Jul 2002 Posts: 26 Location: Canada
|
Posted: Wed Jul 31, 2002 6:56 pm
Patterns? %0 %-1? |
Hi, I have a simple question about %-1 and %0...what do these do exactly? when used either in a trigger or anything else. All I know about are the %1 to %99 paramaters used in a trigger..
|
|
|
|
Apollyon Wanderer
Joined: 02 Oct 2001 Posts: 76 Location: USA
|
Posted: Wed Jul 31, 2002 9:35 pm |
this may be wrong be here i go
in a trigger such as
#trigger {%1 leaves %2} {%2; kill %1}
the %1 and the %2 just stand for variables, or names that can change, the rest of the stuff can remain constant, you may not want to use that trigger or else if you did you would attack everythign that leaves the room you are in
the %-1 is used mostly in aliases, or so i think such as
#alias {sa} {emote says in a fearsome voice, '%-1'}
where the %-1 will take all of the text you entered after sa and put it in the ' '
so you type:
sa hello everyone
and this pops out:
Zene says in a fearsome voice, 'hello everyone'
thats about it, its not somethign that i think needs alot of detail |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Aug 01, 2002 12:00 am |
Apollyon, %1..%n should not be used in the pattern of a trigger. Instead, you use a wildcard and surround it with parenthesis.
%0 technically does not exists. If you use it, results may be unpredictable and it may break at any time in future versions.
%-1 works like Apollyon said. You can also use %-2..%-n. %-1 gets all the words after the name of the alias. %-2 gets all the words sent to the alias starting from the second one. %-3 gets all the words sent to the alias starting from the thirs one. And so on.
Kjata |
|
|
|
Apollyon Wanderer
Joined: 02 Oct 2001 Posts: 76 Location: USA
|
Posted: Fri Aug 02, 2002 5:27 am |
Ok heres a question i have then along these same lines
i used to use a trigger that went something like this:
#trigger {^You sense a trail (*) from here.} {%1; backstab @hunted}
where hunted was a variable of a person i was going after, now my problem with using this wildcard was that people you spam emote stuff like
You sense a trail remove all; drop all from here.
and by spamming it it would set off the trigger at times. so i changed it to make all six triggers for the six directon that mud offered, i was wondering, if i used say %1 instead of (*) would it just pick up one word, or would it still pick up all that text, and if there is a way for zmud to check if the (*) is more than one word and then dismiss that i would love to know.
thats all i can think of for now
"They tell Soze they want his territory - all his business. Soze looks over the faces of his family... Then he showed these men of will what will really was." |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Fri Aug 02, 2002 7:06 am |
The key is to pattern lock it as best as possible.
You could specify a word only
#trigger {^You sense a trail (%w) from here.$} {%1; backstab @hunted}
but you are open to "You sense a trail quit from here."
#trigger {^You sense a trail (%w) from here.$} {#IF %ismember(%1,{north|south|east|west|up|down}) {%1; backstab @hunted}}
This checks to see if that word is part of the list before doing it.
You could specify a list of things only
#trigger {^You sense a trail ({north|south|east|west|up|down}) from here.$} {%1; backstab @hunted}
The %1 captures the first bracketed ( ) thing. Make sure what you put in the brackets to pattern match is as close as possible to what you expect.
See
http://www.zuggsoft.com/zmud/help6/Pattern_.htm
for matching types.
Ton Diening |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Aug 02, 2002 5:59 pm |
You could also use the direction wildcard.
#TR {^You sense a trail (%t) from here.$} {%1; backstab @hunted}
LightBulb
Senior Member |
|
|
|
Apollyon Wanderer
Joined: 02 Oct 2001 Posts: 76 Location: USA
|
Posted: Sat Aug 03, 2002 4:38 am |
just wondering but you both used the $ after the first line(input) of the trigger, what does that do, if anything
--------------------------------------------------
"They tell Soze they want his territory - all his business. Soze looks over the faces of his family... Then he showed these men of will what will really was." |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Aug 03, 2002 4:59 am |
quote: $ force pattern to match ending at the end of the line
I only used it because I copied my example from Ton's to save typing.
LightBulb
Senior Member |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sat Aug 03, 2002 5:27 am |
In many muds with that kind of message,
they usually have a blank line after the
hunt message so you could lock down the
trigger possibly more with:
#TR {^You sense a trail (%t) from here.$$} {%1; backstab @hunted}
Depends on the spoofs that can be done and the
location of the spoof relative to the order
which things appear.
Ton Diening |
|
|
|
|
|