Help with chat_redirector

Posted by Lippa on Wed 15 Feb 2012 11:24 PM — 15 posts, 43,551 views.

#0
Hi,

I run the Chat_redirector plugin which send the chat to a world called Chat Window, which works fine. However, I wanted to add a similar window which just takes the Auction Data from the main world.

I literally just copy/pasted the Chat_redirector plugin - renamed it Auction_redirector and then Did a Find All/replace All in the document changing the word chat to auction. I then changed the triggers to suit my needs.

However, when I try to install the second plugin I get the error message :-

Line 22: The plugin 'Chat_Redirector' is already loaded. (Cannot load)

If I uninstall chat_redirector and install the auction_redirector it works fine, so it is not the plugin itself.

Just wondering if someone could please tell me what I am doing wrong?

Also, I cant seem to get the logging to work for the redirected window, is this possible?

Thanks in advance :)
#1
At the top of your plugin, there is a Plugin Name, and a Plugin ID. Those should be changed (the ID is necessary, the Name would just be helpful).
#2
Oh, I see! Thankyou.

Can I just change the id to anything?
It is currently:=

id="cb84a526b476f69f403517da
Amended on Thu 16 Feb 2012 01:10 AM by Lippa
#3
Under the Edit Menu in Mushclient, there is an option labeled Generate Unique ID. You can use that to create a new ID that should be different from any others you may use. Of course, you could just change one character in the id (to something from 0-9 or a-f), and that would work too.
#4
Awesome, that works. Thanks very much.

Is there any reason that logging wont work on the two dummy world windows I now have set up?
Australia Forum Administrator #5
Lippa said:

Also, I cant seem to get the logging to work for the redirected window, is this possible?



How have you got logging configured? Redirected chats are notes, not world output.
#6
I have log notes and html checked but it is not creating the log files at all.

The logging for the main world window is working fine.
Amended on Thu 16 Feb 2012 09:47 AM by Lippa
Australia Forum Administrator #7
If it isn't creating the file you may have a problem with the path, such as, it doesn't exist.
#8
Ive double checked and triple checked the path and it is correct.

When I click the Log session in the file menu it will work for that session but I cant get it to work automatically....

Australia Forum Administrator #9
Auto log is triggered by a connection being established (that is, it starts logging when you connect).

Since "dummy" worlds are never connected, auto log won't kick in.

You would need to have some other way of doing it, like a plugin that opens the log file when the world is opened, not when the world is connected.
#10
Ahhh, thanks. I thought it might be something like that.

But if I added a plugin which just opened the log files, that wouldnt automatically make it start logging would it?
Australia Forum Administrator #11
What do you mean by "start logging"? The log file would be open but nothing would be written until the main world sent it.
#12
Thanks Nick. Sorry, by "start logging" I meant when the main world sent the data to that world.

I havent added a plugin to open the log files as yet, but I manually created the file (as per the autologging path spec - AuctionLog%a%d%b%Y.txt) before opening mushclient and connecting to the MUD.

However, the logging of the data still would not start until I manually clicked the Log Session in the file menu. It isnt a major problem to keep doing this, but was just wondering why?
Australia Forum Administrator #13
Lippa said:

But if I added a plugin which just opened the log files, that wouldnt automatically make it start logging would it?


The plugin would need to open the log file when the world opened. Something like this:

Template:saveplugin=OpenLogFile
To save and install the OpenLogFile plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as OpenLogFile.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file OpenLogFile.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="OpenLogFile"
   author="Nick Gammon"
   id="ac6f9e1e6d36ffaf37f5573a"
   language="Lua"
   purpose="Opens the log file"
   date_written="2012-02-22 13:38:37"
   requires="4.70"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Opens the configured log file when the world is opened.
]]>
</description>

</plugin>

<!--  Script  -->

<script>
<![CDATA[

function OnPluginInstall ()
local err = OpenLog ("", true)
  if err == error_code.eOK then
    ColourNote ("white", "blue", "Log file " .. GetInfo (51) .. " opened.")
  elseif err == error_code.eLogFileAlreadyOpen then
    return
  elseif GetInfo (40) == "" then
    ColourNote ("white", "red", "No auto log file specified.")
  else
    ColourNote ("white", "red", "Could not open log file: " .. GetInfo (40) .. "")
  end -- if
end -- OnPluginInstall

]]>
</script>

</muclient>

#14
That worked a treat, thanks Nick!