Redirecting chat to a notepad

Posted by Pure on Sun 21 Mar 2010 11:51 AM — 3 posts, 14,602 views.

#0
Hi!

I am trying to redirect all pages and channel stuff to a notepad, for easy reading.
However, the stuff that I send to the game does not trigger it.

This is my trigger:
^[(.*?)] (.*?)$

Which executes:
AppendToNotepad ("Chat:WNOHGB", "%0")


Is there anything wrong with that?
Also, what is the newline char?

Thanks in advance!
Australia Forum Administrator #1
It helps to see the whole trigger and not just excerpts. For example, we don't know if you turned on the "regular expression" flag from what you posted.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Assuming you did ...

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.



^[(.*?)] (.*?)$


Inside square brackets it means "one of a set", so that would only match on a single one of "(", ".", "*", "?".

You need to escape the square brackets:


^\[(.*?)\] (.*?)$


A newline is \n however because of the way Windows edit windows work, you also need a carriage-return. So it would want to be:


AppendToNotepad ("Chat:WNOHGB", "%0\r\n")

Australia Forum Administrator #2
And since send-to-script expands those, you need to double them:



AppendToNotepad ("Chat:WNOHGB", "%0\\r\\n")