|
Valint Wanderer
Joined: 12 Nov 2003 Posts: 70 Location: USA
|
Posted: Sat Feb 07, 2004 11:26 pm
Gagging without creating multiple prompts |
My dilemma is one that I'm sure has come up before, but after trying a number of different methods without solving it, I'd thought I see if I were overlooking something basic.
The problem is gagging a fairly steady stream of data, without creating a steady stream of prompts. In this case, the mud is Gemstone, and I'm trying to gag logon/logoff triggers.
The trigger is essentially:
#TR { ~* (%x) {joins the adventure|returns home from a hard day of adventuring|has disconnected}.$} {#IF (!%ismember( %1, @friends)) {#GAG}}
As such, it works perfectly, but also produces a steady stream of '>' running down my screen.
I've tried a few other solutions, such as adding a #COND {^>} {#GAG} {within|param=1}, to no avail.
Any suggestions? |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Sun Feb 08, 2004 4:37 am |
does your prompt contain the ">" ?
> pickles joins the adventure.
If so you then just gag it.
#trig {^>~* (%x) ({@logs}).$} {#IF (!%ismember( %1, @friends)) {#GAG}}
actually have not tested this prsonaly but should work.
if not try this
#trig {^(>)~* (%x) ({@logs}).$} {#IF (!%ismember( %2, @friends)) {#GAG}} |
|
|
|
Valint Wanderer
Joined: 12 Nov 2003 Posts: 70 Location: USA
|
Posted: Sun Feb 08, 2004 7:35 am |
> does your prompt contain the ">" ?
Let me explain further:
The text displayed without any gagging:
* Joe just joined the adventure
>
* John returns home from a hard day of adventuring
>
Greg arrives.
>
Jane smiles.
>
* Jane has disconnected.
> gaze up
You gaze heavenward.
Gagging just the lines where people logon/logoff work, but since they're all followed by prompts, I end up with line after line of just ">". |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Sun Feb 08, 2004 9:13 am |
#tr {^>$} {#gag} this will remove all ">"followed by nothing.
Make sure your > does not have any space after it, if so you will just include it likes so:
#tr {^>%s$} {#gag}
you could make this a condition so as not to remove them all. |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Feb 09, 2004 4:22 pm |
Iirc, you can gag more than 1 line. #gag 2, should work to gag 2 lines, ie, the line containing the pattern, and the next line.
|
|
|
|
Valint Wanderer
Joined: 12 Nov 2003 Posts: 70 Location: USA
|
Posted: Mon Feb 09, 2004 7:38 pm |
Sure, but the problem is that there's not *always* a prompt before or after the gagged line--if there's a lot going on, there might be a few lines of text sent between prompts, in which case I don't want to automatically gag lines with useful text. If I could count on there always being a prompt, it'd be easy.
Breaking it down into two triggers turned out to be the best option:
#TRIGGER { ~* (%x) ({joins the adventure|returns home from a hard day of adventuring|has disconnected}).} {#IF (!%ismember( %1, @friends) & !%ismember( %1, @merchants)) {#GAG}
#TRIGGER {^>%s$} {}
#COND { ~* (%x) {joins the adventure|returns home from a hard day of adventuring|has disconnected}.} {#IF (!%ismember( %1, @friends) & !%ismember( %1, @merchants)) {#GAG -1}} {within|param=1}
Oddly, the following, which is what I had started with, didn't work even though they look functionally identical to me:
#TRIGGER { ~* (%x) ({joins the adventure|returns home from a hard day of adventuring|has disconnected}).} {#IF (!%ismember( %1, @friends) & !%ismember( %1, @merchants)) {#GAG;#IF ({%line2}={"> "}) {#GAG -1}}
After banging my head against the wall with this one, it turned out that %line2 doesn't always grab the line before the trigger pattern, which seems like a bug to me. |
|
|
|
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Mon Feb 09, 2004 9:45 pm |
There's not really a very good way to do this with zScript... while it's certainly possible to use prompt detection and keep track of whether there are any ungagged lines between prompts (and therefore whether or not to gag the final blank line and prompt), you will often still get the original text appearing until it is gagged resulting in jerky scrolling.
One way around this issue is to use #GAGBLOCK to hide all lines by default and then selectively show them one by one
match every line, showing only those that do not match the thing to gag. This has several drawbacks, however. In order to prevent things from triggering on a given line of text twice (the hidden and shown versions), you'd have to uncheck Trigger on trigger for the trigger that shows lines... however, this would mean you couldn't alter the display of the shown line via triggers. So it'd have to be done on the hidden line before the trigger that shows them. The showing trigger would need to be set as an ANSI trigger in order to have the ANSI colors available to the trigger to put in the shown line. However, this would still strip out effects achieved with MXP, I believe.
Once those things that can be worked around are, the main issue with this method is the large amount of overhead... every line matches the trigger and must execute commands.
So the way I do it is by cheating and using my CommsParser plugin (URL in linked topic is outdated, one can download it [url="www.wotmud.org/forums/viewtopic.php?type=0&topic=46824&forum=55&12"]here[/url]).
There's never really been much interest in making it MUD-independent, however. |
|
|
|
|
|
|
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
|
|