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
jetyap
Newbie


Joined: 28 Feb 2008
Posts: 8

PostPosted: Tue Mar 25, 2008 11:24 am   

Suggestion for New Feature: Capture/Gag Selected
 
Currently #CAP captures a line. I would like to suggest that there's a new one which captures/gag the text triggered instead of the whole line.

E.g.

{hp:100 mp:100}XYZ tells you 'hey there'.

I only want to capture/gag XYZ tells you 'hey there'. instead of the whole line.
Reply with quote
shalimar
GURU


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

PostPosted: Tue Mar 25, 2008 11:30 am   
 
#TR {(XYZ tells you 'hey there'.)} {#SUB {};#WIN windowname %1}
_________________
Discord: Shalimarwildcat
Reply with quote
jetyap
Newbie


Joined: 28 Feb 2008
Posts: 8

PostPosted: Tue Mar 25, 2008 12:08 pm   
 
That doesn't capture the colors though :(
Reply with quote
shalimar
GURU


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

PostPosted: Tue Mar 25, 2008 12:13 pm   
 
Your right.
_________________
Discord: Shalimarwildcat
Reply with quote
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Tue Mar 25, 2008 5:33 pm   
 
Hrm. If you know that the text is always going to start with a new color, though, you can catch it all (including the color) with a regex. I believe the following will work, but I haven't tested it:
Code:
#regex {(\e\[[0-9;]++m[^\e]+?tells you '[^'\e]++'.)} {#sub {};#win windowname %1}

I agree, though, that it would be simpler to have a partial-line capture primitive.
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Tue Mar 25, 2008 6:20 pm   
 
Hmm, in zMUD, doing "#SUB {}; #CAP windowname 1" would save the line to the window, preserving the color. But I tried a quick test in CMUD, and it didn't work. Maybe I just did something wrong, though. Anyone else know if #CAP preserves color attributes?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Mar 25, 2008 6:40 pm   
 
Cap preserves colour just fine, but his problem is that he only wants to capture half the line. I'm guessing that it's a side-effect of the text-running-into-prompts issue reported in another thread.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Tue Mar 25, 2008 6:58 pm   
 
My point was is that at least in zMUD you can #SUB all you want on a line to remove text, then #CAP it. I think that does what he wanted, and preserves color. And after the #CAP, I think you can even #GAG it if you wanted.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Mar 25, 2008 7:13 pm   
 
Ah, I see! But he wanted to leave the prompt intact and only remove the first part. So you'd need to save the line first and print it again afterwards, which is just as inconvenient given that it might be coloured.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Tue Mar 25, 2008 8:19 pm   
 
It gets a bit trickier if he wanted to leave the line intact in the main window (and logs), but strip it from the capture window. In that case, I think the best solution is to #CAP the whole line, then create triggers in the capture window to do whatever text stripping is wanted using #SUB or #PSUB.
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