HOF autolog conversion from forum style to HTML style

da_Vinci

Gypsy Prince
Joined
Jun 13, 2004
Messages
4,182
Location
Maryland, USA
Hi all,

Hope the mods don't gripe about this being here and not the HOF forum, but with the number of HOF newcomers using it for GOTM (and perhaps not reading HOF forum), seems to make sense here.

I think the autolog has forum style as the default, so many of us probably have GOTM 12 in that style. Here is a way to convert that to the HTML style which will display nicely in your browser:

Open the log in any program that will find and replace text. Rename the file with extension .html (so your original stays intact)

Then, in this order, for the whole file ... (remove the x from bx and ux for your find/replace actions in 1 and 2 below... I had to add them so that the forum would display them, not read the b u as instructions and just execute)

1. Replace [bx][ux] with <b><u>

2. Replace [/ux][/bx] with </b></u><br> (if you want double space, an extra <br> after the first one will do that)

3. Replace [/color] with </span><br>

4. Replace [color=" with <span style="color: (note that you need to include one space after the <span style="color: )

5. Replace ] with >

Save the .html file with these changes made.

Now open your .html file, and you should have a log with color coded text (if you had colors on in the settings when the log was created) open in your browser.

Enjoy!

If it doesn't work, post it here in case I have mistranscribed something above.

dV

edit: OK, the forum codes are being read in the forum, so ignore this until I can fix that!
edit2: adding the x to b and u in 1 and 2 has worked. Remove the x for your find/replace action in 1 and 2
Before I added the x, the forum commands were gone, and text was bolded. So the fix is in.

If this is confusing, just save 3 to 5 turns in each format in a test autolog, and it will become clear what we are doing.

dV
 
um...or once you initialize the HOF mod, you just change the tags from forum tags to html tags. that way you don't even have to bother with all of this mess
 
Thanks da_Vinci.

Some of us are too old to remember to update the HOF ini every time we install the next version of the mod. I'm always having to change the coding in one or more txt files after the fact.

Didn't check your procedure. I do see in that my text editor I used a specific replace command for each different color.

I'm too lazy to write a program to do it, although it is obviously amenable to one.
 
you don't even have to bother with all of this mess
Right. No more mess ....

Inspired by da-Vinci's efforts, and using his text replacement procedure ( :goodjob: ), I've put together an Autolog Converter page. Paste your autolog text into the top field and click Convert. If necessary it will be converted to HTML text, and it will be displayed below in all its colourful glory.
 
Thrallia said:
um...or once you initialize the HOF mod, you just change the tags from forum tags to html tags. that way you don't even have to bother with all of this mess
@ Thrallia: Conquistador 63 had written (in my autolog warning thread) "Interesting topic. I've been using HoF mod for GOTM games since it became available, and always wondered about a better way to view the autolog file." This suggested that some have an archive of forum style logs that they might want to view in html. Of course, if you know you want the html style, setting that up at the start is simpler.

My GOTM 12 was logged in forum, so I needed conversion at least for that game.

dV
 
ewokimpi said:
Thanks da_Vinci.
Didn't check your procedure. I do see in that my text editor I used a specific replace command for each different color.

@ewokimpi: At first, I thought I would have to do color by color replacement, but then I realized that if you use the order that I used, you could split the replacement of the color text into the part before the color and the part after the color and make it color independent. The "replace ] with >" only works because at the end, it is the last ] in the text.

dV
 
Thrallia said:
nice :) maybe I should actually look at it in html before I wonder why everyone prefers it to the forum style...
@Thrallia: Do you have a way to display the color instruction that forum style contains outside of the forum?

If you do, what is that secret?

If you don't, then you are in for a treat!

dV
 
I thought I did...but I just realized when I looked back at my files through Notepad++(my text editor, the only way to go if you are a programmer) that it doesn't color code the code, it just color the forum code lol

this coming WOTM maybe I'll try using the html tags instead and see what all the fuss is about :p
 
Thrallia said:
this coming WOTM maybe I'll try using the html tags instead and see what all the fuss is about :p
@Thrallia: better still, load up Svelte's test game for GOTM 12, play about 5 to 10 turns in html, and that will give you the idea.

No sense logging an entire WOTM in html if you end up hating it.

dV
 
My post #4 may have escaped your attention. You can reformat your existing autolog forum code as html instantly ... NOW!
 
For the record, based da_Vinci's posting above, I use the following sed script to change the autolog file to html.

Code:
sed -e 's/\[b\]IBT\:\[\/b\]/\<hr\>\<b\>IBT\:\<\/b\>\<br\>/' -e 's/\[b\]\[u\]/\<b\>\<u\>\<br\>/ ' -e 's/\[\/u\]\[\/b\]/\<b\>\<\/u\>\<br\>/ ' -e 's/\[\/color\]/\<\/span\>\<br\>/ ' -e 's/\[color\=\"/\<span style\=\"color\:/ ' -e 's/\]/\>/g ' -e 's/\[/\</g' autolog-gotm17.txt > t.html
 
For the record, based da_Vinci's posting above, I use the following sed script to change the autolog file to html.

Code:
sed -e 's/\[b\]IBT\:\[\/b\]/\<hr\>\<b\>IBT\:\<\/b\>\<br\>/' -e 's/\[b\]\[u\]/\<b\>\<u\>\<br\>/ ' -e 's/\[\/u\]\[\/b\]/\<b\>\<\/u\>\<br\>/ ' -e 's/\[\/color\]/\<\/span\>\<br\>/ ' -e 's/\[color\=\"/\<span style\=\"color\:/ ' -e 's/\]/\>/g ' -e 's/\[/\</g' autolog-gotm17.txt > t.html

Nice job! :goodjob:

I guess you can teach an old thread new tricks! :lol:

dV
 
After going through my log for my GOTM report, I'm thinking of writing a script to parse the autolog and produce an index of things like start/end war, capture/raise cities etc.

Probably never happen ;)
 
After going through my log for my GOTM report, I'm thinking of writing a script to parse the autolog and produce an index of things like start/end war, capture/raise cities etc.

Probably never happen ;)

I've written a perl-script that extract researched beakers and produced hammers. The accumulated values are printed together with turn + date. PM me if you want the script.
 
I'm not sure I understand what this thread is all about, so if my suggestion is off target, then please ignore it. The way I convert autolog output to a nice readout it is to copy it to a reply to any post on this forum. Then I preview the post. Then I copy this preview to Word for saving. I DO NOT finish posting to the forum. :lol: You may have to break autolog output into several parts due to limitations on the length of posts.
 
Right. No more mess ....

Inspired by da-Vinci's efforts, and using his text replacement procedure ( :goodjob: ), I've put together an Autolog Converter page. Paste your autolog text into the top field and click Convert. If necessary it will be converted to HTML text, and it will be displayed below in all its colourful glory.

Does anyone a screen shot of the two different version of an autolog text file? When I tried the conversion a few months ago I got nowhere so I thought maybe I already see the HTML. :)
 
sorry for being a noob, but how do you turn on the autolog in the game?
In options, I check autolog, but nothing happens. What button do i need to press to turn this on?
 
Top Bottom