Chat

Posted by Imperian_Addict on Sat 17 Dec 2005 06:13 PM — 4 posts, 16,659 views.

#0
I just started to experiment with the great chat that mush has, but I cant figure out how to append the incomming\outgoing messages to a notepad window using Lua.
Please help me...

\Surakai
Australia Forum Administrator #1
I found bug in the chat callback functions when using Lua. This is under investigation, and I will post a lengthier reply tomorrow.
Australia Forum Administrator #2
There was probably an easy answer to that, but I decided to do it the hard way and rewrite the chat plugin in Lua.

In the process I found a couple of problems in the way Lua handled plugin callbacks, which are fixed in version 3.72.

The principle one was that the "return true" or "return false" was not being processed correctly for various complicated reasons.

The second problem was that the dates returned to Lua (such as the date of the chat session) was in the Windows date format, not the Unix date format. I have changed the way dates are returned to Lua to make them easier to display.

Shortly I will upload the Lua version of the chat plugin, which you can use. The important part, which you need to solve your problem is to uncomment a few lines in the middle of the plugin, namely, to make the OnPluginChatDisplay function look like this:


function OnPluginChatDisplay (message, sText)

--
--  We will take normal incoming and outgoing chats and emotes, and
--  display them in a notepad window, and omit them from the main window
--


   if message >= 4 and message <= 9 then
     AppendToNotepad ("Chats", 
                      Replace (StripANSI (sText), "\n", "\r\n"), "\r\n")
     return false
   end -- if 

  
  return true -- display it

end -- function

Amended on Wed 21 Dec 2005 01:57 AM by Nick Gammon
Australia Forum Administrator #3
The new version of MUSHclient is now released, and the Lua chat plugin is available from the plugins download page.