 |
cypren Wanderer
Joined: 03 Nov 2000 Posts: 59
|
Posted: Tue Feb 06, 2007 1:58 am
Gagging duplicate lines |
I've got a rather complex settings package assembled where a lot of data from the MUD is being parsed and re-routed (via a COM plugin that intercepts and MXP line tags the lines) to half a dozen different windows on the screen. This works quite well, but the MUD sends a prompt after every block, even the blocks which are being captured to another window. This results in a lot of duplicate prompts cluttering up the main MUD window as various blocks of information get routed in and captured into the sub-windows.
What I'm looking for is a way to have the main window trigger on a prompt, and examine the last displayed line in the scrollback buffer, and if they're identical, discard it. It needs to look at the last displayed line rather than the last received line because all kinds of triggers may have fired in the interim to change data, route lines to windows, etc.
Right now I have a semi-effective trigger setup working like this:
Code: |
#TRIGGER {^(%w)>$} {#IF (@squelchPrompt) {#GAG} {#T+ FindNonPromptLine;#VAR squelchPrompt 1}} "Interface"
#TRIGGER "FindNonPromptLine" {^(*)$} {#IF (%regex( %1, "\w+>") > 0) {} {#T- FindNonPromptLine;#VAR squelchPrompt 0}} "Interface" |
This seems to fail to catch a lot of duplicate lines, however, and I wind up with MUD output that looks like this:
Code: |
look
[Town Square, West]
Here in the midst of the town stretches the cobblestoned main bazaar, its lamplit lanes abuzz with traders and vendors hawking their wares at any hour of the day or night. Groups of citizens, discussing the day's events or preparing for nighttime hunts, gather around the doors of the merchants whose shops border the square. The gilded but peeling stone facade of the First Elanith Bank dominates this side of the square. You also see a shaggy mutt, a massive wheeled tower, a blanket of snow and a blanket of snow.
Obvious paths: north, east, south, west
I>
I>
A flower girl arrives, whistling a merry tune.
I>
I>
The flower girl smiles and says, "For giving me a few silvers, you can have a whole handful of these petals!"
I>
The shaggy mutt sniffs around the room, apparently searching for you!
I>
The flower girl hums a merry tune, twiddling her fingers idly.
I>
I> |
This is still a huge improvement on what it would look like otherwise -- there would probably be about 8-10 more duplicated prompt lines without the trigger setup -- but obviously, it's failing to catch everything, probably due to timing issues or triggers firing out of order, etc.
Is there a way I can make this setup more reliable and turn it into a simple, "examine last line, if same as current line, gag"? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 06, 2007 2:25 am |
Have you tried %line and %line2?
#if (%line=%line2) {#gag}
sounds like what you're after but I'm not sure if that works on displayed or recieved. |
|
|
 |
cypren Wanderer
Joined: 03 Nov 2000 Posts: 59
|
Posted: Tue Feb 06, 2007 2:35 am |
Thanks Fang, that was EXACTLY what I was looking for. I can't believe I reviewed the predefined variables so many times and never noticed that. I'm a moron.
|
|
|
 |
|
|
|
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
|
|