 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 01, 2006 9:34 am
Question: Function for pattern of trigger? |
What's the function that returns the entire pattern that matched a trigger? I know there's one because I remember seeing it used, but I couldn't find it on the function list. It could be useful when substituting MXP codes. And #sub in general really.
|
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Dec 01, 2006 12:56 pm |
%trigger or %line?
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 01, 2006 2:57 pm |
I looked at the help for %trigger, and it says it's the same as the %class function. %line isn't on the list.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 01, 2006 6:23 pm |
I believe that within MXP triggers you can use %0 to fetch the full trigger pattern, but this might have gotten messed up when I changed %0 to work the same as %-1. But it's worth a try.
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 01, 2006 6:36 pm |
Nope, doesn't work. I created this trigger:
mxptest (*)
with the script
#sub {<send ~"some command~">%0</send>}
#echo Triggered
and the #sub replaced it with nothing. If I changed it to %1, it works as expected creating a <send> surrounding the contents of (*), but no luck with %0. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 01, 2006 6:50 pm |
OK, I'll add that to the bug list.
You might also try %line. It *should* be in the list of system variables, and it returns the line that caused the trigger. Not sure exactly what this returns within an MXP trigger though. |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 01, 2006 7:01 pm |
%line worked. Thanks Zugg, I knew there was some way of doing it.
|
|
|
 |
|
|