|
jetyap Newbie
Joined: 28 Feb 2008 Posts: 8
|
Posted: 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. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Tue Mar 25, 2008 11:30 am |
#TR {(XYZ tells you 'hey there'.)} {#SUB {};#WIN windowname %1}
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
jetyap Newbie
Joined: 28 Feb 2008 Posts: 8
|
Posted: Tue Mar 25, 2008 12:08 pm |
That doesn't capture the colors though :(
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Tue Mar 25, 2008 12:13 pm |
Your right.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
JQuilici Adept
Joined: 21 Sep 2005 Posts: 250 Location: Austin, TX
|
Posted: 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! |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: 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?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: 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.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: 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.
|
|
|
|
|
|