[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Removing repeating lines from output

Removing repeating lines from output

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by xxRezinxx   USA  (7 posts)  [Biography] bio
Date Wed 13 May 2015 06:22 PM (UTC)
Message
I recently added a chat window plugin in my client. Following instructions in one of your earlier posts. It works great! Thank you! But now, in my main window, with my character standing still for a few minutes I end up getting my prompt over and over until it fills up the main window.
I have seen this problem mentioned in a couple of posts but not a solution anywhere.

<100hp 100m 100mv>

<100hp 100m 100mv>

<100hp 100m 100mv>

<100hp 100m 100mv>


Is it possible to create a script or trigger something along the lines of:
get line_1: ^(.*?)$
get line_2: ^(.*?)$
if line_2 == line_1
---then hidefromoutput=y
---reevaulate line_2
else hidefromoutput=n

<100hp 100m 100mv>
-hidden-
-hidden-
-hidden-
You went north.
<100hp 100m 100mv>
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Wed 13 May 2015 06:42 PM (UTC)

Amended on Wed 13 May 2015 06:50 PM (UTC) by Fiendish

Message
Yes.

If you always get the prompt immediately after a chat line, then you could create a disabled trigger that gags the next incoming line and then disables itself. You would enable that trigger when you gag a chat line.

You could also create a gagging trigger that gags a particular line, and then change the pattern to match the previous line sent every time a new line comes in.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 13 May 2015 07:53 PM (UTC)
Message
I usually use an "omit blank lines" trigger (ships with the client) that fixes one of those two lines.

As for the prompt, the simple thing is to make a trigger that matches your prompt (whatever it is) and omits it. Then inside the trigger you see if the prompt is different from last time. If it is different you display it from the trigger.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Wed 13 May 2015 08:06 PM (UTC)

Amended on Wed 13 May 2015 08:10 PM (UTC) by Fiendish

Message
Nick Gammon said:

As for the prompt, the simple thing is to make a trigger that matches your prompt (whatever it is)

Déjà vu
http://www.gammon.com.au/forum/?id=10728&reply=98#reply98

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 13 May 2015 09:10 PM (UTC)
Message
Certainly, reply #97:

Quote:

This is a fairly common problem, because the MUD sends two prompts. You may have suppressed the "You say 'hello' " message but you haven't suppressed the second prompt.

One approach is to detect prompt lines in a trigger, omit them, and then in a script detect if the prompt has changed. If it is different, echo it (Note or ColourNote it). That suppresses multiple identical prompts.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #5 on Thu 14 May 2015 03:17 AM (UTC)
Message
I prefer #98 and #99 ;)

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #6 on Thu 14 May 2015 06:27 AM (UTC)
Message
Nick still hasn't said that is a good approach to the problem, just a very simple one.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by xxRezinxx   USA  (7 posts)  [Biography] bio
Date Reply #7 on Sat 16 May 2015 11:42 AM (UTC)
Message
The blank-line removal plugin helps significantly. After reading some of the other comments I'm on the fence about hiding the prompt.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #8 on Sat 16 May 2015 08:06 PM (UTC)

Amended on Sat 16 May 2015 08:33 PM (UTC) by Fiendish

Message
Note: Important context for this first part is that I write plugins primarily for other people, not for myself.

Hiding any particular text pattern, including just blank lines, without attention to context, can have negative consequences. In this case you're making it so that the game can never send you two blank lines for any reason ever. That could be as harmless(?) as not seeing what an area builder intends or in the most extreme case could break some other plugin. Either way, it's a bit "sledgehammer for a nail". You'll definitely drive the nail, but you may also split the surrounding wood.

You need to hide the next lines after any hidden chat, right? That's useful context that you could use.

But it shouldn't be too hard to evaluate your own situation by asking two questions:
1) Do you care about missing double blanks/prompts that exist for other reasons?
2) Do you want anyone else to be able to use this without having to edit the script for their own prompt?

You might answer no to both and stop worrying. :)

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


24,494 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]