 |
DeathDealer Adept

Joined: 20 Jul 2004 Posts: 268
|
Posted: Thu Mar 10, 2005 6:11 pm
Strict ending of trigger **SOLVED** |
Feeling like a fool cause I can't remember, or find, how to have a trigger end strictly.
Like I have a trigger that turns off a folder on
-------------------------------------------------------------------------
But it also seems to go off on
--------------------------------------------------------------------------
which is one more '-' than i want.
and would this work as part of a | ?
#TRIGGER {{------------------------------------------------------------|-------------------------------------------------------------------------}} {#T- Tiers}
The whole code is for Aardwolf. I have a problem with the tier titles and can never keep them straight.
#ALIAS {finger} {#T+ Tiers;~finger %1}
#ALIAS {whois} {#T+ Tiers;~whois %1}
#CLASS {Tiers}
#TRIGGER {{Gladiator|Barbarian|Battlemaster|Warlord|Liege|Veteran|Berserker|Savage|General}} {#SUB WarriorT}
#TRIGGER {{Priest|Oracle|Prophet|Saint|Patriarch|Martyr|Bishop|Exorcist|Crusader}} {#SUB ClericT}
#TRIGGER {{Nightblade|Rogue|Assassin|Ninja|Cutthroat|Crimelord|Stalker|Prowler|Godfather}} {#SUB ThiefT}
#TRIGGER {{Necromancer|Lich|Wizard|Warlock|Magician|Conjurer|Illusionist|Sorcerer|Archmage}} {#SUB MageT}
#TRIGGER {{Mystic|Telepath|Channeler|Dreamwalker|Mindflayer|Mentalist|Visionary|Mindshifter|Enlightened}} {#SUB PsionicistT}
#TRIGGER {{Knight|Cavalier|Slayer|Avatar|Zealot|Terminator|Benefactor|Holy Blade|Avenger}} {#SUB PaladinT}
#TRIGGER {{Hunter|Beastmaster|Tracker|Wayfinder|Woodsman|Explorer|Strider|Scout|Protector}} {#SUB RangerT}
#TRIGGER {{------------------------------------------------------------|-------------------------------------------------------------------------}} {#T- Tiers}
#CLASS 0 |
|
_________________

Last edited by DeathDealer on Fri Apr 01, 2005 8:08 pm; edited 1 time in total |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Mar 10, 2005 6:39 pm |
a few ways to do it, if the pattern should be at the end of the line you can use the $ character to force a match at the end of the line
if the pattern you want is followed by a space then add a space to the end of the pattern to force a space to be there.
if you make the trigger a regex trigger then (?<!-)-{73}(?!-)
should work it matches 73 exactly 73 hyphens not preceded or followed by a hyphen.
This could be replaced
| Code: |
| #TRIGGER {{------------------------------------------------------------|-------------------------------------------------------------------------}} {#T- Tiers} |
could be replaced by this
| Code: |
| #REGEX {(?:(?<!-)-{60}(?!-)|(?<!-)-{73}(?!-))} {#T- Tiers} |
find out more about perlre assertions here
http://www.perl.com/doc/manual/html/pod/perlre.html |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
DeathDealer Adept

Joined: 20 Jul 2004 Posts: 268
|
Posted: Thu Mar 10, 2005 7:34 pm |
The regex worked perfectly.
For some reason the $ at the end didn't.
| Code: |
| #TRIGGER {{------------------------------------------------------------$|-------------------------------------------------------------------------$}} {#T- Tiers} |
Thanks :-) |
|
_________________
 |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Mar 10, 2005 7:44 pm |
$ wont work if there are spaces or anything else following the hyphens
|
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
DeathDealer Adept

Joined: 20 Jul 2004 Posts: 268
|
Posted: Thu Mar 10, 2005 8:11 pm |
there aren't any
at least not that I can see on there.
the entire row is the -'s |
|
_________________
 |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Mar 10, 2005 8:17 pm |
oh its because in zmud triggers the string between non capturing groups {} cant contain special characters
thus the $ doesnt match a end of line it just matches a plain "$" character.
| Code: |
| #TRIGGER {{------------------------------------------------------------|-------------------------------------------------------------------------}$} {#T- Tiers} |
should work. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
DeathDealer Adept

Joined: 20 Jul 2004 Posts: 268
|
Posted: Thu Mar 10, 2005 8:44 pm |
Crap, I didn't think about putting the $ at the end like that.
Shoulda tried that when the $ after the -'s didnt work.
either way, it looked awful with all those -'s your regex version is much cleaner.
thanks again.
*bookmarks this thread cause in a week it will be forgotten * |
|
_________________
 |
|
|
 |
Spartacus Wanderer
Joined: 23 Apr 2001 Posts: 53 Location: USA
|
Posted: Fri Mar 11, 2005 7:50 pm |
The regex will also be a lot lighter on your system than the regular pattern matching if I understood the writeups on the regex engine correctly.
|
|
_________________ Spartacus
rm -rf .* |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Fri Mar 11, 2005 7:57 pm |
Not at all Spartacus since Zmud translates the pattern into proper regular expressions anyways.
When making or editing a trigger if you go to the test tab you can see the regex pattern that Zmud is using. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
Spartacus Wanderer
Joined: 23 Apr 2001 Posts: 53 Location: USA
|
Posted: Fri Mar 11, 2005 8:01 pm |
Cool - learn something new every day!
|
|
_________________ Spartacus
rm -rf .* |
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Jun 30, 2005 1:48 pm |
Just a quickie question, cause I was reviewing my old posts and never saw the exchange between Spartacus & Dharkael.
"since Zmud translates the pattern into proper regular expressions anyways."
Wouldn't then actually MAKE it faster? Meaning then that zmud don't have to make the translation and can run it much quicker.
It would be a benefit in cases where there are many triggers all running at the same time.
Or would it just mean that zmud still has to read it and run the translating regardless to make sure that it's correct nullifying any benefit of speed? |
|
|
|
 |
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: Thu Jun 30, 2005 3:02 pm |
| Vitae wrote: |
Just a quickie question, cause I was reviewing my old posts and never saw the exchange between Spartacus & Dharkael.
"since Zmud translates the pattern into proper regular expressions anyways."
Wouldn't then actually MAKE it faster? Meaning then that zmud don't have to make the translation and can run it much quicker.
It would be a benefit in cases where there are many triggers all running at the same time.
Or would it just mean that zmud still has to read it and run the translating regardless to make sure that it's correct nullifying any benefit of speed? |
How it's done is that the "zMUD expression" is turned into a regular expression (behind the scene and hidden) when you save it and thus only converted once, not every time you run it since that would indeed make it very slow. |
|
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Jun 30, 2005 3:52 pm |
soooo.....
I input a trigger, and it only runs once a login, everytime i start zmud it's unconverted, then converted when it is used.
I input another trigger that is used a few hundred times an hour. It's converted the 1st time it's used, but close zmud, restart it and it's unconverted again?
just wanna make sure i got it clear :-) |
|
|
|
 |
DeReP Adept
Joined: 14 Jun 2003 Posts: 222 Location: Chile
|
Posted: Thu Jun 30, 2005 6:55 pm |
I think he means that you input the trigger, and the trigger window will show the normal pattern, but the *saved* trigger will be a regular expression
They are not translated when you open zmud, just once when created. |
|
|
|
 |
Vitae Enchanter

Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Jun 30, 2005 7:37 pm |
ah, so it's saved in regex, then viewed in normal.
got it. |
|
|
|
 |
Atreides_096 Wanderer
Joined: 21 Jan 2005 Posts: 99 Location: Solvang, CA
|
Posted: Sat Aug 27, 2005 12:44 am |
Quick note: don't forget (%s) for spaces.. tho in this case there are no spaces, you could do:
^------------(%s)$ |
|
|
|
 |
|
|
|