Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Suggestions
➜ HTML Logging of Commands & World.Send [& more blank lines]
HTML Logging of Commands & World.Send [& more blank lines]
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Fri 14 Jun 2002 09:40 AM (UTC) |
Message
| I think I've mentioned this before, but here I go again:
Do a World.Note in your script, and it logs fine, in the colour of the note. Cool.
Do a World.Send, and it doesn't log at all. World.WriteLog logs in the default colour for the HTML page (usually black). Also, regular commands you enter are not logged in the "echo_colour" you have configured.
Preferably, the following functionality could be coded directly into MUSHclient:
Log text sent via command box in "echo_colour".
Log text sent via World.Send in "echo_colour". *
* World.Send does not currently log at all.
I've tried to work around this, which has presented several problems:
Sub LogSend (SendString)
Dim Preamble, Postamble
Dim CommandColour
World.Send SendString
If World.GetOption("log_html") Then
CommandColour = World.CustomColourText(World.GetOption("echo_colour"))
Preamble = World.GetAlphaOption("log_line_preamble_input")
Preamble = Preamble & "<font color='" & CommandColour & "'>"
Postamble = World.GetAlphaOption("log_line_postamble_input")
Postamble = "</font>" & Postamble
World.WriteLog Preamble & World.FixupHTML(SendString) & Postamble
Else
World.WriteLog SendString
End If
End Sub
Looks like it should work, but the colour is wrong, for some reason (though not the default black). I thought maybe the echo_colour started from 0, so I put a -1 before the second closing bracket on the relevant line. Different colour, but still wrong. Hmmm....
The Preamble and Postamble don't work as easily as I would like. Variables are not evaluated, so I end up with a literal %H:%M> in my logs, rather than the current hour and Minutes. I could rip the string apart and build a proper pre-amble, but that just seems so bothersome at the moment. I doubt I will.
Setting the font above is actually overkill in my case, since this is the setting I currently have for logging:
log_line_postamble_input="</font>"
log_line_preamble_input="%H:%M> <font color=#FF8040>"
I set the font colour directly in the pre-amble, because it's the only way to get text entered into the command box to be in the colour I want (short of triggering every line and sending it through this routine).
...So, currently I have the font lines in the script commented out, and rely on the font settings stored directly in the pre & post amble.
I was thinking of building a Plugin to do all of this automatically, so that I wouldn't have to manually adjust the settings for every world. Also, since some people find the setup too complex, it would be easy to just hand them a file to have it work... but I don't see how that is possible with the current implementation. (The font colour is hard-coded in the pre-amble, instead of pulling it from the settings). Alternatively, I might just try and build a default file with all my personal colour and logging options in one file, if that is possible. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #1 on Fri 14 Jun 2002 09:45 AM (UTC) |
Message
| Something else I noticed while playing around with this:
It appears blank lines are still being sent to the output and log file, although not like before.
If I send a single line via script, it will have a blank line afterwards.
If I send multiple lines via script, there will only be a blank line after the last line sent. (both in output window and logs). |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sat 15 Jun 2002 02:53 AM (UTC) |
Message
| OK, I'll investigate all that. The %H should be converted, sounds like a bug. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #3 on Mon 17 Jun 2002 06:39 AM (UTC) |
Message
| I have a standalone plugin that I keep various script routines in, that I expect will be used by an assortment of other plugins. Unfortunately, it means all of my "plugin" releases will actually be two plugins: The main plugin, and a "Script Tools" plugin with common script routines in it.
I use Logsend instead of World.Send in all my scripts, and would like to do so in all my plugins, so it's important that I get the routine mentioned above working, and in a manner that is accomodating to anyone else using my plugins.
...So thanks for responding, and I look forward to getting this cleaned up. :) |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 20 Jun 2002 03:54 AM (UTC) |
Message
| I don't see a big problem with releasing a second plugin that is used by all your other ones. That was what the ability to call routines in other plugins was done for.
However another approach would be to include the other routines rather than call them. The effect would be slightly different, you would have different copies, so any (local) variables would not be shared. However it means you don't need to rely upon the plugin actually being installed.
eg.
<include name="my_common_routines.xml" /> |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 08 Aug 2002 12:22 AM (UTC) |
Message
| OK, I see what is wrong here:
CommandColour = World.CustomColourText(World.GetOption("echo_colour"))
This will send (for instance):
<font color='255'>
This is not valid HTML. You need this:
<font color='red'>
To do this in the script you need one more call:
CommandColour = World.RGBColourToName (World.CustomColourText(World.GetOption("echo_colour")))
Then it will work. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #6 on Thu 08 Aug 2002 03:21 AM (UTC) |
Message
| Somewhere in another thread, I recommended this:
Take the internal code for "World.Note" logging, clone it and edit it, and use it for "World.Send" as well.
The World.Note logging works perfectly, logging in the proper colour, with the proper variable explansion for line pre-ambles, etc. If World.Send worked the same way, there would be no need for my subroutine.
Since it's unlikely many plugin writers will write their code to log World.Send functions, it puts the user in an uncomfortable position of having to modify the plugin to get the full logging they may expect. This really should be the job of MUSHclient, in my humble opinion. :) |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 09 Aug 2002 02:11 AM (UTC) |
Message
|
Quote:
Variables are not evaluated, so I end up with a literal %H:%M> in my logs, rather than the current hour and Minutes.
Seems to work for me - where did you have them? Line preamble, file preamble? Was HTML on or not? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #8 on Fri 09 Aug 2002 02:32 AM (UTC) |
Message
| Same subroutine posted up at the top. The %H:%M> is pulled from "log_line_preamble_input" in my world.xml file. (Which is where it is saved after I used the "Configure - Logging" Interface to set the appropriate field.)
In essence, the problem is that:
World.GetAlphaOption("log_line_preamble_input")
returns the literal string, not an evaluation of the variable markers within that string.
I'm sure I, or any other programmer could parse and evaluate the value returned from that function. Personally, I can't be bothered to do the work, as I still hold hope that you'll read my last message in this forum and follow that suggestion. :) (I'm still wishin you'd answer why it's not feasible). LOL.
Anyway, you said in an E-mail that you've added "World.LogSend". That should also resolve the problem. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #9 on Fri 09 Aug 2002 03:11 AM (UTC) |
Message
| Ah yes, it does indeed return the literal value of that setting. Could be annoying if it didn't. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,496 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top