Plugin to omit blank lines

Posted by Nick Gammon on Thu 10 Jul 2008 06:07 AM — 3 posts, 23,925 views.

Australia Forum Administrator #0
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>


USA #1
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.
Amended on Sun 05 Oct 2008 06:49 PM by Artel
USA #2
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>