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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Plugin to omit blank lines
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Plugin to omit blank lines

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Nick Gammon   Australia  (15,394 posts)  [Biography] bio
Date Thu 10 Jul 2008 06:07 AM (UTC)  quote  ]
Message
Sometimes you find multiple blank lines in your MUD output, especially if you are omitting other lines from output. The simple plugin below will omit all blank lines from your output window.

For this to work you need to go to the File menu -> Global Preferences -> General and make sure that "Regular expressions can match on an empty string" is checked.


To use, copy from between the lines below, save as Omit_Blank_Lines.xml in your MUSHclient -> Worlds -> Plugins folder, and then use the File menu -> Plugins to install it.



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 07, 2008, 1:07 PM -->
<!-- MuClient version 4.31 -->

<!-- Plugin "Omit_Blank_Lines" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Omit_Blank_Lines"
   author="Nick Gammon"
   id="87a0ec3649ab9a04d5ea618d"
   language="Lua"
   purpose="Omits blank lines from output"
   date_written="2008-07-07 13:06:47"
   requires="4.00"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Omits completely empty lines from output.
]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^$"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>

</muclient>



- Nick Gammon

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

Posted by Artel   USA  (63 posts)  [Biography] bio
Date Sun 05 Oct 2008 05:32 PM (UTC)  quote  ]

Amended on Sun 05 Oct 2008 06:49 PM (UTC) by Artel

Message
Is there a way to adapt this to only omit a line if it is part of a sequence of multiple blank lines?

i.e., if I receive \n\n, one of the blank lines should be omitted so that only \n remains. If I receive a single \n though, nothing should be omitted.

Artel.
[Go to top] top

Posted by Artel   USA  (63 posts)  [Biography] bio
Date Fri 10 Oct 2008 11:01 PM (UTC)  quote  ]
Message
I figured out what I was trying to do. Here is the resulting plugin:



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, October 10, 2008, 3:56 PM -->
<!-- MuClient version 4.37 -->

<!-- Plugin "OmitExtraBlankLines" generated by Plugin Wizard -->

<muclient>
<plugin
   name="OmitExtraBlankLines"
   author="Artel"
   id="62cda216f28bf192128a16a0"
   language="Lua"
   purpose="Omits extraneous blank lines from output."
   date_written="2008-10-10 15:51:00"
   requires="4.00"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Reduces subsequent blank lines to a single blank line.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^$"
   name="blank_line_two"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   sequence="75"
  >
  </trigger>
  <trigger
   enabled="y"
   match="^.+$"
   name="blank_line_three"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger("blank_line_two", false)
EnableTrigger("blank_line_three", false)</send>
  </trigger>
  <trigger
   enabled="y"
   group="BlankLines"
   match="^$"
   name="blank_line_one"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTrigger("blank_line_two", true)
EnableTrigger("blank_line_three", true)</send>
  </trigger>
</triggers>

</muclient>

Artel.
[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.


1,938 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]