Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Dec 01, 2006 12:56 pm   
 
%trigger or %line?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Dec 01, 2006 7:01 pm   
 
%line worked. Thanks Zugg, I knew there was some way of doing it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net