Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion Goto page Previous  1, 2, 3
nutsnbolts Posted: Wed Jun 26, 2002 5:56 pm
Converting ANSI to HTML?
Deathlok
Newbie


Joined: 03 Sep 2002
Posts: 9

PostPosted: Wed Oct 09, 2002 12:16 am   
 
I'm working on a new version that fixes a little bug. For some reason some ansi codes show up 20 higher than they should. Not sure why zMud outputs them incorrectly but I'm working on correcting it.

Also, the new version will now support blinky text. :D

You know you love it. ^_^

Look for it tomorrow (version 1.1 beta will be posted on www.thefiresauce.com)
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Wed Oct 09, 2002 11:45 am   
 
I am assuming you are referring the codes 50-57 that zMUD sometimes uses to indicate a bold color?

As far as I know:

0 resets to defaults
1 turns on bold
4 turns on underlining
5 turns on blinking
6 turns on italics
7 turns on reverse mode
21, 24, 25, 26 and 27 turn off the corresponding attributes above
30-37 control forecolor
40-47 control backcolor
50-57 control forecolor and indicate bold attribute is on


I've just finished a plugin that integrates with zMUD and enables both logging to HTML on-the-fly and converting existing logs like ANSI2HTML does. It supports all the attributes I've listed and has a configuration screen quite similar to the zMUD color settings (complete with color pickers so you don't have to know the RGB values). I've also taken a hex editor to zMUD's .col files so the plugin can load them directly and a user can avoid having to pick out their colors twice (once for zMUD, once for the plugin).

While I made it in Visual Basic, it is absolutely nothing like what Tarn posted in this thread. I designed the engine from the ground up... instead of the character-based logic employed in Tarn's, it processes a line at a time. I didn't even read Tarn's code until 2 days ago (I've been using and testing my plugin personally for a little less than a week).

Like ANSI2HTML, it delays putting in tags until it absolutely has to.

It defaults to using an embedded style sheet but you can change the options to so it links instead. The style sheet format I've employed is not compatible with ANSI2HTML. This shouldn't be a problem since if you make an external style sheet, it will be htmllog.css.

It's a COM-based plugin so it only works on zMUD 6.x. A run down of its commands:

#HTMLLOG outputfilename [ "Title to use on the webpage outputted" ] [ new ]
The functionality is basically identical to #LOG but with the title (which is optional) added in. Also, #HTMLLOG without parameters will turn off the log but won't turn it back on.

#HTMLSETUP
Displays the configuration screen. This is where you change all the settings.

#HTMLCONVERTLOG inputfilename outputfilename [ "Title to use" ]
Converts an ANSI color log to HTML. The title is optional.

You can basically access all these commands through the menu anyway so you don't really need to know them.

To get color settings set up properly, go to View, Preferences, Colors and then click Save Colors. Once it's saved, close out of the dialog and go to Plugins, HTML Logger, Setup... Here, click the "Load zMUD .col file..." button and select the file you just saved.

Erm, I suppose I should tell you where you can get it. The title is HTML Logger.

If you find a bug/have a question/whatever, feel free to tell/ask/whatever.

 - Charbal
Reply with quote
nutsnbolts
Apprentice


Joined: 01 May 2002
Posts: 188
Location: USA

PostPosted: Wed Oct 09, 2002 4:50 pm   
 
Once again, I want to give respect and props to you guys for creating this. Took about 8 months of the software evolving. Well it isn't one software but your contributions is commended.

Thank you very much!

Thank you for everything, it's always appreciated.
Reply with quote
Deathlok
Newbie


Joined: 03 Sep 2002
Posts: 9

PostPosted: Thu Oct 10, 2002 10:52 pm   
 
Yes, I was referring to the 50-57 codes. I didn't see any reference to them in any of the ansi standard tables and sometimes it would include the 1 (bold) tag along with them. Unless someone can point me to a newer table I'll just assume they're a non-standard (or new) way of showing bold colors. Either way ver 1.1 takes care of it.
(the new version has been up for the last 2 days. Any new bugs will get fixxed as they are reported)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Oct 11, 2002 2:21 am   
 
I believe that these codes represent the standard ANSI colors paired with the bold code. zMUD uses these codes every time it displays a bold color instead of having to add the bold attribute to the ANSI sequence. In particular, these codes appeared to be closely tied in with the %color function and the colors (and order) described in the help file.

Kjata
Reply with quote
Takilara
Apprentice


Joined: 31 Jan 2002
Posts: 129
Location: Norway

PostPosted: Mon Oct 14, 2002 3:16 pm   
 
i do ansi to html parsing on my web page (page to keep pk-logs)
There is a link on that page to "test" logs before ppl post them to see that colors turn out ok, i guess you could use this page to test the log, then save web page as to save the log as html,
the main page is on http://dlogs.net
the testspage is on http://dlogs.net/test2.php
you should also download the file http://dlogs.net/styles.css and keep it in same folder as the logs itself (then it looks better)
Please do not use it for very large logs (3000+ lines) unless your mud has an entry on the page, since it takes a lot of parsing and cpu power of the server. If you ppl like it, i could attemt to port it to some windows prog or something..


Reply with quote
Sabo
Newbie


Joined: 17 Oct 2002
Posts: 5

PostPosted: Tue Nov 19, 2002 2:34 pm   
 
That is a sweet idea for a site(pklogs). Think I will start one up myself for the MUD I play. I tried your converter and it looked good for the most part. Dropped some colors here and there and they weren't the right colors(pretty close) but I didn't dl the file you said to dl to make it look better so that's likely where I went wrong.

Once again excellent site, you have inspired me.
Reply with quote
Takilara
Apprentice


Joined: 31 Jan 2002
Posts: 129
Location: Norway

PostPosted: Wed Nov 20, 2002 12:25 pm   
 
Heh, i hope you would consider letting my page keep the logs from the mud you play on, instead of making a similar page :)

Reply with quote
Sabo
Newbie


Joined: 17 Oct 2002
Posts: 5

PostPosted: Wed Nov 20, 2002 2:06 pm   
 
If you would like to that would be cool. I just figured you wouldn't be interested. The mud I play on just came back from a long downtime and is hosted on the IMMs personal computer so it goes down once in awhile still. The whole player base isn't back yet and as far as I know my buddy and I are the only ones that pk(and by pk, I mean hunt people, not duel, those are lame).

To me half the fun in killing someone is finding them despite their efforts.

If you would like to start one though I could surely give you some kills. Get in contact with me. AIM: we clusion ICQ: 30021623 I also use some other chat programs but your best bet is one of these.
Reply with quote
morwen
Beginner


Joined: 07 Nov 2002
Posts: 24
Location: United Kingdom

PostPosted: Wed Nov 20, 2002 4:05 pm   
 
Just a little pedanticism, but 21 isn't actually the code for bold off. It's the code to turn double underline on (!).

--
Morwen, Coder, the Cryosphere
Reply with quote
Sabo
Newbie


Joined: 17 Oct 2002
Posts: 5

PostPosted: Wed Nov 20, 2002 5:23 pm   
 
Oh and about the script on your site, I don't think it was the problem. I looked at the ansi file zmud created and it is at fault I believe. Some colors show as 1s or 0s for some reason. Anyone know which setting I can use to correct this?
Reply with quote
Takilara
Apprentice


Joined: 31 Jan 2002
Posts: 129
Location: Norway

PostPosted: Thu Nov 21, 2002 8:50 am   
 
In the preferences you need the scheme to be VT100 for it to work ok, in ANSI mode it seems too many color codes are left out or spanned across lines.
However some more info on setting up zMUD for using that script:
http://dlogs.net/colorfaq.php

Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Fri Nov 22, 2002 10:54 am   
 
quote:

Just a little pedanticism, but 21 isn't actually the code for bold off. It's the code to turn double underline on (!).

--
Morwen, Coder, the Cryosphere



Researching it a bit, I see you are right. While I don't have the source I used offhand, this particular error has apparently been proprogated rather well.

A discussion on Nick Gammon's board just two months ago that I found highlights this problem.

That in mind, I'll probably repackage and release version 1.1 tomorrow. Also fixed will be 2 small bugs in converting existing logs from HTML (not logging from the MUD stream).

One of these bugs is that the plugin disregards the command-line specified title entered for #HTMLCONVERT and pops up a dialog box prompting for one anyway (does not affect menu-driven log conversions). The other bug is that converted logs (whether by menu or #HTMLCONVERT) do not properly escape symbols with special meaning in HTML. That is, & and < are left as-is instead of being converted to &amp; and < as they should be. Again, this is properly handled when logging directly from the MUD to HTML.

Thanks for the heads-up.

 - Charbal
Reply with quote
nutsnbolts
Apprentice


Joined: 01 May 2002
Posts: 188
Location: USA

PostPosted: Fri Nov 22, 2002 2:59 pm   
 
Let us know when you have release 1.1. I would like to update mine.

Thank you for everything, it's always appreciated.
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Mon Dec 09, 2002 10:34 am   
 
It's taken much longer to get version 1.1 out than I thought it would... aside from not having much time, I also fixed some additional bugs and added new features. Also, I had to get a new distribution point since Aennor is no longer hosting our plugins at their former home.

Get it here.

Features:
Ability to run as a standalone application as well as a zMUD COM plugin
Batch conversion a la ANSI2HTML. You can either drag files to the file window or use Add Source button to select them.

Changes:
Changed bold clear from 21 to 22
Implemented 21 as regular underline (no double-underline available in HTML that I know of)
Added support for ANSI codes 39 (default forecolor), 49 (default backcolor), 9 (strikethrough), 29 (clear strikethrough attribute).
Command-line version of #HTMLCONVERT no longer ignores the title given
Converted logs properly escape symbols with special meaning in HTML (&, <, >)
Fixed bug that kept saved background colors from being loaded the next time the plugin was loaded
Fixed various things with the open/save/font dialog boxes
Changed plugin description in zMUD to more accurately reflect its function
Added DOCTYPE declaration to output HTML files
Added blink support without requiring an external file in versions of IE supporting the JavaScript function used
Fixed so that ANSI flags were always initialized when starting a log (some cases slipped through the cracks)
Replaced color boxes in setup screen with labels modified to look like color boxes (had been much more memory-intensive PictureBoxes).
Color 2 (the default color) changed from the standard color attributes to zMUD's slightly brighter version of the same.
A few code tweaks to optimize throughput. The parsing algorithm used in the engine has not been modified in this version.

Also, when comparing ANSI2HTML and HTML Logger I found out several things:
When you have a process like Prime95 taking up your idle cycles (running at priority one), ANSI2HTML seems to yield its cycles to the lower priority application even though it shouldn't. So I had to test without Prime95 running.

I used a P4 1.7GHz laptop with 512MB RAM and a 47.8MB log made from Drasan (which has got to be the most insanely colorful MUD I have ever seen). I used this because a key element in my algorithm is skipping ahead to the next ANSI color code and thus it requires more time to run when there are many color codes with little spacing in between them in the input file.

Time:
HTML Logger: 73.188 seconds
ANSI2HTML: 4 minutes, 7 seconds

I/O Reads/Bytes Read
HTML Logger: 98,010/50,174,232
ANSI2HTML: 33,258,004/17,027,999,725 ?!?
That's the equivalent of reading through the file 340 times!

Also, after ANSI2HTML has written 64MB into an HTML file, the progress bar restarts at the beginning though nothing else seems to be affected.



 - Charbal
Reply with quote
Deathlok
Newbie


Joined: 03 Sep 2002
Posts: 9

PostPosted: Wed Jan 15, 2003 9:21 am   
 
Feh. If you email me what you find about my program, it will get fixxed much, much faster.

Presenting Version 1.2 beta (after all, this is what a beta is for!)

"When you have a process like Prime95 taking up your idle cycles (running at priority one), ANSI2HTML seems to yield its cycles to the lower priority application even though it shouldn't."

Fixxed. Made the program a bit more aggressive.


"Time:
HTML Logger: 73.188 seconds
ANSI2HTML: 4 minutes, 7 seconds

I/O Reads/Bytes Read
HTML Logger: 98,010/50,174,232
ANSI2HTML: 33,258,004/17,027,999,725 ?!?
That's the equivalent of reading through the file 340 times!"

Feh. I knew I forgot to do something. :P
I flipped the 'buffer input instead of reading/writing 1 character at a time' switch and now it reads/writes the files much, much more effeciently. Silly me forgetting to turn off the debug on that piece of code. Of course, that means that now we get to test the new file routines. yay. :)

"Also, after ANSI2HTML has written 64MB into an HTML file, the progress bar restarts at the beginning though nothing else seems to be affected."

Just a stupid display error. fixxed.



The new file is, as always, up at www.thefiresauce.com
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net