 |
Edwub Wanderer
Joined: 21 Nov 2002 Posts: 85 Location: USA
|
Posted: Tue Dec 24, 2002 10:55 am
two line trigger using variables |
Trying to make a trigger that gossips when I save someones life, without being set off manually by my "friends" hehe
This is an example
| 1203H 818M 513V > You bandage the wounds of Arthas, probably saving his life.
You receive some exp for your noble deed.
I can't use ^ because it shows up after my hmv stats.
Right now, i have:
#trigger {You bandage the wounds of %1, probably saving {his|her} life.} {#var justbandaged %1}
#trigger {You receive some exp for your noble deed.} {gossip @justbandaged - bandaged and alive!}
I'm sure it can be shortened or brought into at least a single trigger, but still not be set off by other people.
Thanks zmud users!
Edwub the Mage |
|
|
 |
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Tue Dec 24, 2002 11:11 am |
One thing to keep in mind is that you shouldn't use %1, %2, etc. in a trigger pattern. Instead use one of the pattern matching expressions and surround it with parenthesis to capture to one of these variables.
This should probably do it for you:
#TRIGGER {You bandage the wounds of (*), probably saving {his|her} life.$You receive some exp for your noble deed.$} {gossip %1 - bandaged and alive!}
More efficient than a multi-line trigger like this would be a multi-state trigger but the only public version that works in is 6.40 and you didn't say what you are using.
- Charbal |
|
|
 |
Edwub Wanderer
Joined: 21 Nov 2002 Posts: 85 Location: USA
|
Posted: Tue Dec 24, 2002 11:36 am |
Why shouldn't %1 etc be used?
On basic trigs like PK They work great, but if i try to expand and they can cause troubles I can see why it would be bad.
Btw, thanks!
Edwub the Mage |
|
|
 |
Kjata GURU

Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Dec 24, 2002 11:42 am |
They are not used in patterns, only in the commands of the triggers. When used in patterns, their behavior is similar to (*), but this is not always constant and there is no guarantee of it working in the future. The correct way is to use wildcards in the pattern and surround them with ()'s when you want to use whatever they matched.
Kjata |
|
|
 |
seamer Magician
Joined: 26 Feb 2001 Posts: 358 Location: Australia
|
Posted: Tue Dec 24, 2002 12:34 pm |
Another reason you shouldnt use %1, unscrupulous people can exploit the #dde server in your pc if (usually they dont even know you're using %1, i've had people just say random stuff hoping to find flaws). What is DDE? From zmud, type in #help dde and see what it can do :P
Taken from your original example,
| 1203H 818M 513V > You bandage the wounds of %1, probably saving {his|her} life.}
can be abused with something like:
Arthas says 'You bandage the wounds of #dde {notepad} {c:zmudtranslation.txt}, probably saving his life.'
This will open the translation.txt file in notepad assuming you have zmud located in c:zmud, but from this you can see how potentially whacked %1 can leave you in the hands of an uber dork :) Or instead of doing something on a specific file, a default browser can be opened and launched to an unfriendly URL and do nasty things.
This is also a reason as to why %1 shouldnt be used in a trigger :)
Why oh WHY did I have pass door on... |
|
|
 |
Edwub Wanderer
Joined: 21 Nov 2002 Posts: 85 Location: USA
|
Posted: Wed Dec 25, 2002 7:10 am |
Thanks for the replies, going back to fix all my triggers...
and Seamer, thanks for your post *evil cackle*
Sometimes I'm an uber dork myself *rubs hands and waits* ;)
Edwub the Mage |
|
|
 |
|
|