<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, August 27, 2010, 12:34 PM -->
<!-- MuClient version 4.58 -->

<!-- Plugin "EventLog" generated by Plugin Wizard -->

<muclient>
<plugin
   name="EventLog"
   author="Samakhulis"
   id="b53e65794e288f0256c817b0"
   language="Lua"
   purpose="Logs various events. Filtering based on colour and tells/party/says prefixes."
   save_state="y"
   date_written="2010-09-03 09:15:00"
   requires="4.50"
   version="2.31"
   >

<description trim="y">
<![CDATA[
=======================================================
This plugin will match certain lines of text and write them to a Notepad window for saving into a separate log file. This will allow one to filter out stat lines, as well as put blank lines in between all separate actions.

Emotes are usually sent in plain white, but can be changed using CONFIG COLOUR EMOTES <fg> <bg>. The "black" trigger requires that emotes are changed to a bright-black on black (a dark grey). If you leave your emotes as default white, the ENABLE WHITE alias will be required to log them.

  Requirement: CONFIG COLOUR EMOTES 8 0

-------------------------------------------------------
Commands:
  START LOGGING - Begin logging to notepad.
  STOP LOGGING - Stop logging, save and close notepad.
  KILL LOGGING - Stop logging and close without saving
  PAUSE LOGGING - Halt logging temporarily.
  UNPAUSE LOGGING - Resume a previously-halted log.
  LOGNOTE <message> - Write an OOC note to the log.
  LOGCMD <command> - Log the next white line to the world, and send the command.
  ENABLE WHITE - Logs all default-white strings, including ambience, weather, attack msgs, illusions, etc.
  DISABLE WHITE - Disable default-white logging.
  TITLE EVENT <title> - Titles your event, which will change your filename on close.
  SET EVENTLOG PATH=<New Path> - Set save location. Example: "C:/MUSHClientLogs/Eventlog/" (Must include trailing slash)
    Note: If you wish to properly use backslashes, use a double-backslash, as a single denotes an escape character.
  EVENTLOG PATH - Show current save location.
  
  EVENTLOG:HELP - This message.
=======================================================
]]>
</description>

<!--REVISIONS:
Rev:
-1.0  (08-29-2010) - Simply a plugin to see if I could match colour values and Note() echo them below the matched line.
-2.0  (09-03-2010) - Rerouted echo to a notepad and added the on/off aliases. Required a little bit of colour tweaking.
-2.1  (09-03-2010) - Added the lognote command.
                   - Created the NPAppend alias in order to ensure that log files could be later edited with proper line-breaks.
-2.2  (09-03-2010) - Added the enable/disable white commands, giving the user the option to turn off non-IRE room descs.
-2.3  (09-03-2010) - Added the title event command, which changes the variable used upon STOP LOGGING to title the log file.
-2.31 (02-06-2011) - Added LOGCMD to the help documentation and also added the proper standard help commands and scripts: EVENTLOG HELP
-2.32 (02-06-2011) - Fixed LOGCMD to also echo the typed command rather than just its output. Prepends actual command with "-".
-->

</plugin>


<!--  Triggers  -->

<triggers>

  <trigger
   match="^(.*?)$"
   match_text_colour="y"
   match_back_colour="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   text_colour="8" 
   back_colour="0"
   group="logging"
   name="black"
  >
  <send>Execute("NPAppend %1")</send>
  </trigger>


  <trigger
   match="^(.*?)$"
   match_text_colour="y"
   match_back_colour="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   text_colour="7" 
   back_colour="0"
   group="logging_special"
   name="whitecmd"
  >
  <send>Execute("NPAppend %1")
  EnableTrigger("whitecmd",false)</send>
  </trigger>
  

  <trigger
   match="^(.*?)$"
   match_text_colour="y"
   match_back_colour="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   text_colour="7" 
   text_colour="0"
   group="logging_special"
   name="white"
  >
  <send>Execute("NPAppend %1")
  </send>
  </trigger>
  
  
    <trigger
     match="^(.*?)(says|say|shouts|shout|mutters|mutter|screams|scream|chants|chant|sings|sing|whines|whine|snarls|snarl|whispers|whisper|exclaims|exclaim|asks|ask)(.*?)$"
     regexp="y"
     send_to="12"
     keep_evaluating="y"
     sequence="100"
     group="logging"
     name="cyan"
    >
    <send>Execute("NPAppend %0")</send>
  </trigger>
  
  <trigger
   match="^\(Party\):(.*?)$"
   match_text_colour="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   text_colour="2" 
   group="logging"
   name="green"
  >
  <send>Execute("NPAppend %0")</send>
  </trigger>
  
  
  <trigger
   match="^(.*?)tells you(.*?)$"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   group="logging"
   name="yellow"
  >
  <send>Execute("NPAppend %0")</send>
  </trigger>
  
  
  <trigger
   match="^You tell(.*?)$"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
   group="logging"
   name="yellow2"
  >
  <send>Execute("NPAppend %0")</send>
  </trigger>
  
  
</triggers>



<aliases>

  <alias
   match="start logging"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>
  Execute("NPAppend [Start Log "..os.date("%m-%d-%Y - %H:%M:%S").."]")
  NotepadColour (WorldName().." EventLog", "#00FF00", "#000000")

  EnableTriggerGroup("logging",true)
  

  </send>
  </alias>
  
  <alias
   match="stop logging"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>
  Execute("NPAppend [Stop Log "..os.date("%m-%d-%Y - %H:%M:%S").."]")
  SaveNotepad (WorldName().." EventLog", GetVariable("LogPath")..WorldName().."-"..os.date("%Y %m %d - %H-%M-%S").." - "..GetVariable("EventTitle")..".txt", 0)
  CloseNotepad(WorldName().." EventLog",0)
  EnableTriggerGroup("logging",false)
  Execute("disable white")

  </send>
  </alias>

  <alias
   match="kill logging"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>
  Execute("NPAppend [Stop Log "..os.date("%m-%d-%Y - %H:%M:%S").."]")
  CloseNotepad(WorldName().." EventLog",0)
  EnableTriggerGroup("logging",false)
  Execute("disable white")

  </send>
  </alias>
  
  <alias
   match="NPAppend *"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>AppendToNotepad(WorldName().." EventLog", "%1\\r\\n\\r\\n")</send>
  </alias>
  
    <alias
     match="disable white"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>EnableTrigger("white",false)
    SetVariable("e_white","0")
    Note("White triggering for event logging disabled.")</send>
  </alias>

    <alias
     match="enable white"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>EnableTrigger("white",true)
    SetVariable("e_white","1")
    Note("White triggering for event logging enabled.")</send>
  </alias>
  
  
    <alias
       match="title event *"
       enabled="y"
       group="logging"
       sequence="100"
       send_to="12"
      >
      <send>SetVariable("EventTitle","%1")
      Note("Event title set to: %1")</send>
  </alias>
  
    <alias
     match="lognote *"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>Execute("NPAppend [%1]")</send>
  </alias>
  
  
    <alias
     match="logcmd *"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>Execute("NPAppend -%1")
    EnableTrigger("whitecmd",true)
    Send("%1")</send>
  </alias>

  <alias
     match="pause logging"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>EnableTriggerGroup("logging",false)
    Note("Event logging paused. UNPAUSE LOGGING to reenable.")
    if GetVariable("e_white") == "1" then
      Note("White trigger detected as ON.")
      EnableTrigger("white",false)
    end -- if
	 </send>
  </alias>

  <alias
     match="unpause logging"
     enabled="y"
     group="logging"
     sequence="100"
     send_to="12"
    >
    <send>EnableTriggerGroup("logging",true)
    Note("Event logging resumed.")
    if GetVariable("e_white") == "1" then
      Note("White trigger detected as ON.")
      EnableTrigger("white",true)
    end -- if
	 </send>
  </alias>

  <alias
   script="OnHelp"
   match="eventlog:help"
   enabled="y"
   ignore_case="y"
  >
  </alias>

  <alias
   match="set eventlog path=*"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>
    SetVariable("LogPath","%1")
    Note("EventLog Path set to: "..GetVariable("LogPath"))
  </send>
  </alias>
  
  <alias
   match="eventlog path"
   enabled="y"
   group="logging"
   sequence="100"
   send_to="12"
  >
  <send>
    Note("EventLog Path currently set as: "..GetVariable("LogPath"))
  </send>
  </alias>
</aliases>
<!--  Script  -->

<variables>
  <variable name="EventTitle">EventLog</variable>
  <variable name="e_white">0</variable>
</variables>

<script>
<![CDATA[
function OnHelp ()
  world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end

function OnPluginInstall()
  if GetVariable("LogPath") == nil then
  	SetVariable("LogPath","C:\\Program Files\\MUSHClient\\logs\\")
  	ColourNote("yellow","black","EventLog Path set to: "..GetVariable("LogPath"))
  	ColourNote("yellow","black","SET EVENTLOG PATH=<New Path> to redefine")
  end -- if
end -- function
]]>
</script>


</muclient>
