|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Mar 15, 2009 12:58 am
Pattern Expressions |
If I wanted to use a variable in a Pattern Expression, would I simply put @var_name in the pattern box, or do I need to select an option?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Mar 15, 2009 1:55 am |
What do you mean by "pattern expression"? Do you mean a trigger whose type has been set to "expression" rather than "pattern"? If that's the case, than whatever's in the Pattern box of the trigger will be evaluated as an expression - you'll have to decide for yourself whether or not using your variable that way makes sense in the context of what you want it to do. You could think of an expression trigger like an #if command:
#if (pattern here) {script here}
that's checked every time any of the variables in the pattern changes. If it makes sense to put your variable in an expression on its own, then you can do, but it's more likely you're going to want something like @var_name>250 or @var_name="cheese" in there.
If you didn't mean an expression trigger, then please explain what it is you're after. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Mar 15, 2009 6:15 pm |
Sorry, I was coining a term since I didn't know what the actual term was. To me, the Pattern Expression means it's allowed to have variables in the Pattern, but otherwise works like a normal pattern. It's not an expression, but it can have a variable like an expression can. Something like:
Pattern: <This is a @word>
where @word=prompt
so if you get
<This is a prompt>
from the MUD output, it matches and voila, the trigger has fired. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Mar 15, 2009 6:22 pm |
Don't coin terms without explaining what you mean, or nobody will know what you're on about :P
And yes, that'll work just fine. You could just try it and see :P |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Mar 15, 2009 9:25 pm |
Do note though you may notice some slowdown with that (depending on how often you call it, and how often the variable changes), because every time the variable changes the trigger pattern has to be recompiled.
|
|
_________________ Asati di tempari! |
|
|
|
|
|