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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Thu May 31, 2007 9:51 pm   

New idea?
 
Either a new predefined variable %pattern, which would be like %trigger, except only contain the part of the line that matched the trigger pattern.

Or a new command #CONCAT which would work alot like #SUB, but append the contents of its parameter to the matching text instead of replacing it.
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu May 31, 2007 10:17 pm   
 
Perhaps this might be useful, but you can already emulate the %pattern behaviour by enclosing the whole pattern in brackets - %1 will then become the entire match. Similarly with #concat, since once you've got the trigger set up that way, it's pretty trivial to use #sub to do it for you.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Thu May 31, 2007 10:57 pm   
 
That only works if you don't have %1 defined within the pattern already.
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu May 31, 2007 11:15 pm   
 
Well, no, all the other captures will just get bumped up a space. It's not too hard to make the number one more than it otherwise would be when you write the script.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Thu May 31, 2007 11:31 pm   
 
Aha, i didnt realize the anonymous variables could be nested like that.

What about a predefined variable %id (or some other method) that would return the ID (if defined) of a given setting from within the setting?

That way i could use: #SUB {%1 ~(%id~)}
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu May 31, 2007 11:48 pm   
 
You mean the actual trigger id, the one used for #t+ and #t- and stuff? I'm not sure if there's really a need for a variable for that since it isn't normally changed once it's set - you can just include it in the script as a string.
_________________
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 General Discussion 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