Auto-say helper

Posted by Nick Gammon on Thu 10 Jul 2008 05:52 AM — 2 posts, 15,135 views.

Australia Forum Administrator #0
The auto-say option in MUSHclient is great if you want to have a lengthy conversation with a friend online. Instead of having to prefix each line you type with "tell (friend)" you can just type your message and let MUSHclient do it for you.

However there is one drawback. After chatting away I invariably find that I forget auto-say is on, and then send things like "help dwarf" or "cast heal" to my friend, rather than actually doing them.

The small plugin below is designed to stop that happening. What it does is check every second if auto-say is active, and if so, colours the background of your command window a distinctive colour (I chose palegreen, but you could choose any colour with the assistance of the colour picker).

Then a simple glance at the window - the very place you are typing - visually confirms whether or not you have auto-say active.

To use, copy from between the lines below, save as Auto_Say_Visualizer.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 Thursday, July 10, 2008, 1:28 PM -->
<!-- MuClient version 4.33 -->

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

<muclient>
<plugin
   name="Auto_Say_Visualizer"
   author="Nick Gammon"
   id="379f2b5475fb85cd8de2a2d5"
   language="Lua"
   purpose="Colours command window if auto-say active"
   date_written="2008-07-10 13:27:28"
   requires="4.00"
   version="1.0"
   >

</plugin>


<!--  Timers  -->

<timers>
  <timer 
    enabled="y" 
    second="1.00" 
    send_to="12"
    active_closed="y"
  >
  <send>
if GetOption ("enable_auto_say") == 1 then
  SetOption ("input_background_colour", ColourNameToRGB ("palegreen"))
else
  SetOption ("input_background_colour", ColourNameToRGB ("white"))
end -- if
</send>

  </timer>
</timers>

</muclient>
USA #1
I downloaded this a while ago, but I just got around to testing it out, seems neat, but unfortunately, it seems to make my display flicker every time it runs. It might be better if it stores the status of autosay, and only changes the background color if it's changed, thus avoiding the flicker. Seems to me this'd be as easy as moving the code to a script block, and have a global variable declared to store the value of autosay. Like this:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, July 10, 2008, 1:28 PM -->
<!-- MuClient version 4.33 -->

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

<muclient>
<plugin
   name="Auto_Say_Visualizer"
   author="Nick Gammon"
   id="379f2b5475fb85cd8de2a2d5"
   language="Lua"
   purpose="Colours command window if auto-say active"
   date_written="2008-07-10 13:27:28"
   requires="4.00"
   version="1.01"
   >

</plugin>


<!--  Timers  -->

<timers>
  <timer 
    enabled="y" 
    second="1.00" 
    send_to="10"
    active_closed="y"
    script="AutoSayVisualize"
  >
  </timer>
</timers>

<!--  Script  -->


<script>
<![CDATA[
bWasAutoSayActive = 0

function AutoSayVisualize()
  if GetOption("enable_auto_say") ~= bWasAutoSayActive then
    bWasAutoSayActive = GetOption("enable_auto_say")
    if bWasAutoSayActive == 1 then
      SetOption ("input_background_colour", ColourNameToRGB ("palegreen"))
    else
      SetOption ("input_background_colour", ColourNameToRGB ("white"))
    end -- if
  end -- if
end

function OnPluginClose()
  SetOption ("input_background_colour", ColourNameToRGB ("white"))
end

function OnPluginDisable()
  bWasAutoSayActive = 0
  SetOption ("input_background_colour", ColourNameToRGB ("white"))
end

]]>
</script>

</muclient>



I also added something to restore the input window color if the plugin is disabled or removed, it'll go back if reenabled/reinstalled.