MUSH Logging

Posted by Merilyn on Sat 28 May 2011 03:18 PM — 3 posts, 18,613 views.

#0
Alright, so i'm /trying/ to make it on my logging file so that channels on the game are kept out of the log so that all I have is the RP log.

I'm using Mushclient 4.61
USA #1
Look at Regexp for your main capture trigger. I don't remember the exact switch, but there is probably one to exclude certain substrings such as "Capture everything except something that starts with '(Public):' '(Newbie):' '<Faction>:'" or whatever.

Here's an example I found on StackOverflow:
rx = /^(?!apple$|orange$|juice$)/

Apparently (according to the request made) it matches all combinations of the three words, but does not match the single words themselves. So applejuice is matched, but apple is not, nor is juice. Someone who knows regexp better than me will have to verify and expound.

As for logging (they often wonder why I do it this way), my technique has been to take the triggered line and paste it into a Notepad window. So your trigger would be something like:

Match: Everything except (Public): * ..etc.
Send: WriteNotepad("eventLog","%0")


Then write a few aliases that will start and stop the log among others.

In the start one I usually do something like:
Match:log event
Send:WriteNotepad("eventlog","<timestamp code>")

An interim alias which stores a temporary title:
Match:event title *
Send:SetVariable("eventTitle","%1")

Then finally a finish and close alias:
Match:stop event log
Send:SaveNotepad ("eventlog", "c:/Program Files/MUSHClient/Logs/EL_"..GetVariable("eventTitle")..".txt", 0)
CloseNotepad(WorldName().." EventLog",0)

Also adding a few more aliases allows me to pause and unpause logging. This is just a matter of a few EnableTrigger() functions.


To be very honest, I've kind of put off learning regexp in detail, and my own event logger actually relies on matched colours. This way I can change the colour of channels to something that WON'T trigger and so they will be skipped.

Finally, I was just made aware of the f:write/f:save/f:close functions. And apparently this nullifies any real need for the Notepad. But I like the Notepad idea myself, just because I can make edits if needed. Or if I forget to start it before the RP begins, I can start the log, copy the previous text into the notepad and then rely on the plugin to take it from there.
Australia Forum Administrator #2
You can do it without regular expressions even, if the channel is simple (but you need a trigger per channel), eg.


match = "(chat)*"


Check "omit from log" and "keep evaluating". Also give it a low sequence, so it fires before other triggers.

More stuff about regular expressions:

Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.