[mod] Log changes

eotinb

Ancient and Hermetic
Joined
Sep 14, 2005
Messages
409
Location
Buffalo
autolog v1.2
by eotinb

this mod is part of the eotinb mod suite

A mod to facilitate note taking, with succession games in mind. This mod has been approved for GOTM use: see DaveShack asking in this post in the GOTM01 thread and ainwood giving permission here.

UPDATE
Possible solution to some of the path problems people are having: Make sure your path variable is enclosed in double, not single, quotation marks. Like this: "C:\\civ" not this: 'C:\civ'. The reason is that if you use a directory three that includes \Sid Meier's Civilization 4\ python will interpret the apostrophe in Meier's as the end of the path string if you use single quotation marks.

CHANGES IN VERSION 1.2:

Fixed one of the last quirks -- now all tribal village results are known (before some showed as integers rather than what was actually received). For those who are curious, the possible results are: low gold, high gold, map, settler, warrior, scout, worker, experience, healing, tech, weak hostiles, and strong hostiles.

CHANGES IN VERSION 1.1:

New events logged:
Cities acquired and lost through combat and trade
First contact with another civ

More information added to events logged in previous versions:
Combat notes now display the after-combat strength of the victor.
Log now notes when another civ founds a religion (previously just when you founded a religion) and when a religion spreads and either of the following is true: 1. you control the Holy City, or 2. you control the city to which the religion spreads (previously only the second was true).

New features:
Annoying autosave quirk eliminated. If you don't know what this means, don't worry about it -- just be glad that you didn't have to deal with it.
Alt+E messages are now displayed in both the text file and the in-game log.
You can now see changes to the log file while the game is running (although you cannot edit it until the game is shut down or you make a new log file active).
You can now pick the name of the text log on starting a new game or loading a game, or use the default file name of autolog.txt.
There is now an option to have your log notes color-coded for forum posts. See autolog.py's "color" variable.
Alt+E entries are now preceded with a notification that they are custom user entries. The lead-in message can be changed in autolog.py's "prefixTag" variable.

Removed features:
All additions to the in-game event log have been removed. I will soon be coming out with another mod which will replace some of these functions and add more (my notifications mod). Also, Ctrl+E has been disabled.


INSTRUCTIONS:

Unzip file to My Documents\My Games\Sid Meier's Civilization 4\CustomAssets\python\ (or equivalent)
!!!DO NOT OVERWRITE FILES IN GAME DIRECTORY!!! (i.e. C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Assets\Python)
The three following files will be added:
CvEventManager.py
CvUtil.py
autolog.py

In order to facilitate combining with other mods that also change CvEventManager.py and/or CvUtil.py, the additions (and two minor changes to the original code) have been noted in these files. Feel free to cut and paste to combine.

SETTINGS:

You can select the default file name for the external text file in autolog.py. Check the directory where you want the file to go. THE DEFAULT DIRECTORY MAY NOT WORK ON YOUR COMPUTER, so check it. Just open autolog.py with any text editor and look for "path = ..." and make sure whatever follows the equal sign is a valid directory. Most problems with this mod have been path problems, so check a couple of things: 1. folders in directory structure are separated with a double backslash, and 2. the last folder in the tree does not end with a backslash. Example: "C:\\games\\civ4" would be correct while "C:\games\civ4\" would not.

If you do not change the file name or rename the previous log, a new log will append to an existing log with the same name. This is so you won't accidentally overwrite your old log(s).

You can select what type of tags (<HTML>, [forum], none) for simple pre-formatting in the "style" variable in autolog.py. Also, you can change whether or not forum-style notes are color-coded in the "color" variable in autolog.py. Changing which events get which color or which colors are used is also possible but is not easy -- you have to be willing to dig into the code. If you want to do this and need some guidance from me, feel free to ask in this thread.

FEATURES:

Alt+E: Custom text log entry (also appears on the screen and in the in-game event log). Alt+E entries are preceded with a notification that they are custom user entries. The lead-in message can be changed in autolog.py's "prefixTag" variable.

Events logged in text file:
City founded, city growth, city border expansion, city acquired/lost, city razed, tech learned/started, unit started/built, building started/built, combat results, Golden Age start/end, Great Person birth, tribal village results, promotions, and religion founding/spread.

All of the text file entries can be turned on or off individually via settings in autolog.py. Also, more detail on each type of event can be found in the same place.

QUIRKS:

If when you found a new city you do not use the default name, the log will still show the default name for the city founded event. All subsequent events for that city will display the name you typed in.

UPCOMING:

Ability to alter what is logged in-game (rather than through editing autolog.py).
Ability to export the actual in-game event log (maybe).
Some co-ordination with screenshots.

CREDITS:

Puppeteer at CFC had the original idea that led to this mod.
HawaiiFive-O, Calanor, and a few others at Apolyton worked out how to use CyInterface.addMessage().
TheDarkside at Apolyton lent moral support.
CivGeek and Tubby Rower at CFC had some great ideas which led to the custom user comment prefix and the color-coding.
Requies at CFC told me where to find all the tribal village results.

Note: This updates and replaces eotinbLog, adding enough additional features that I decided a rename (a less self-promoting rename at that :)) was in order. If you use this mod, you can completely erase or overwrite any files that came with eotinbLog.

Here is a sample output (now in color!):
----------------------------New entries----------------------------
Turn 0 (4000 BC)
Rome founded
Rome begins: Warrior
Research begun: Sailing

Turn 1 (3950 BC)

Turn 2 (3900 BC)
Tech learned: Sailing
Tribal village results: technology
Research begun: Bronze Working
User comment: Hut teaches Sailing
Rome's borders expand
Tribal village results: lots of gold

Turn 3 (3850 BC)

Turn 4 (3800 BC)
Rome grows: 2

Turn 5 (3750 BC)
Rome begins: Worker
User comment: Put Warrior on hold while I build a Worker
Buddhism founded in a distant land

Turn 6 (3700 BC)

Turn 7 (3650 BC)

Turn 8 (3600 BC)

Turn 9 (3550 BC)
Tech learned: Bronze Working

Turn 10 (3500 BC)
Research begun: Mysticism
Tech learned: Hunting
Tribal village results: technology
User comment: More techs from huts -- Hunting this time

Turn 11 (3450 BC)

Turn 12 (3400 BC)
Tech learned: Mysticism
Rome finishes: Worker

Turn 13 (3350 BC)
Research begun: Polytheism

Turn 14 (3300 BC)

Turn 15 (3250 BC)
Rome finishes: Warrior

Turn 16 (3200 BC)
Rome begins: Settler

Turn 17 (3150 BC)

Turn 18 (3100 BC)
Hinduism founded in Rome
Hinduism has spread: Rome
Tech learned: Polytheism

Turn 19 (3050 BC)
Research begun: Agriculture
Rome's borders expand

Turn 20 (3000 BC)

Turn 21 (2950 BC)
Rome finishes: Settler

Turn 22 (2900 BC)
Rome begins: Stonehenge
Tech learned: Agriculture

Turn 23 (2850 BC)
Research begun: Animal Husbandry
Rome grows: 3

Turn 24 (2800 BC)
Settler loses to: Barbarian Lion (2.00/2)

Turn 25 (2750 BC)

Turn 26 (2700 BC)

Turn 27 (2650 BC)

Turn 28 (2600 BC)
Tech learned: Animal Husbandry

Turn 29 (2550 BC)
Research begun: The Wheel
Rome grows: 4

Turn 30 (2500 BC)

Turn 31 (2450 BC)

Turn 32 (2400 BC)
Warrior defeats (2.00/2): Barbarian Lion
 

Attachments

I think this will probably be a good thing for people to include as a stock feature of their mods. People who make significant changes with a mod that becomes popular are going to be getting lots of bug reports, and better logs would undoubtedly be helpful in solving them.
 
Not to discourage people from using my mod, but bug reports, etc. can already be viewed by turning on debug, error, etc. logs in the ini file.
 
Certain events now appear in the in-game event log, such as founding a city, etc. There is more detail in the log -- the idea being for SGs, GOTM, or other cases when you want to document what you have done for others (or for your own memory). You can also add your own entries to the log. I eventually want to be able to export the log, hopefully with some formatting options, so that it can be cut'n'pasted right into a forum post.
 
Simetrical said:
Wait, so then what's the advantage of your mod?

For those of us who play SG's this may be a great benefit. Most of us (read SG players) used MS Word in CivIII and just Alt-Tab'ed back and forth to write down turn notes. CivIV seems to have several bugs when Alt-Tab'ing around.

I'll have to check this out, thanks!
 
Thanks eotinb. I've been looking for something to export the log. Is there somewhere that the code behind the saved files are.

Since I came in late to [c3c], I never knew how people deciphered it or where it originally come from. But since I'm starting on ground level with [civ4] I'm expecting to write a couple of laziness inspired programs. :)
 
Tubby Rower -- I'm still working on exporting the log. I bought civ3 the day it came out or thereabouts, but then went into a very long hiatus, only recently coming back to the civ community -- the effect being that I have no better idea than you how to look inside the save files.

As an alternative to exporting the log, it wouldn't be too hard to rig up something in Python to duplicate the log to a text file. I haven't done that because I think its inelegant and I hope it won't be too long before I can do it the better way. But I'm thinking I may as well get something working -- I've tried posting screenshots of the log in place of my write-ups but it just doesn't work as well. Some kind of text file that you can go in and edit is a better starting point. I guess I'm saying watch this space, as I may have a new version coming out pretty soon.
 
That is a brilliantly simple idea - very handy for SGs and GOTMs. Presumably though no use for PBEM reports or anything since the game ignores custom assets in multiplayer (although maybe it doesn't, given the OOS reports I get which might be caused by the clock and domestic advisor mods - in which case it should!)
 
I see the chat log sitting there. maybe there's a way to mod that so that you just type your turnlog in there (no need for chatting in single player), and then cut and past or dump it to a .txt file?
 
For anybody who cares, I've started the process of echoing log entries to a txt file. It works pretty well. So far I can do custom user entries and the following events generate auto-messages: city founded, city growth, tech started/completed, unit started/completed, building started/completed, combat results, city razed, and borders expand. I'm a bit tired of this process at the moment, so tomorrow I'll tackle: promotions, goody hut results, great people born, golden age begin/end, and religion spread (which looks to be the toughest). These may get auto-messages, but right now I'm not planning to do them: city acquired (through trade or conquest), city lost (ditto), first contact with another civ, and war declared/ended. The way the events are set up for those makes them more difficult, and I'm in low-hanging-fruit-gathering mode.

grahamiam, your idea is very good, but I've actually solved the problem of allowing the player to enter a custom log entry that goes to a text file with a keyboard shortcut. The thing that is taking so much time is duplicating all the in-game messages to the txt log file.
 
Ooh! I think this is going to work out very well once I'm finished. Below is a cut and paste from the txt file (simple formatting was done automatically).

4000BC (0): You have learned Mysticism
4000BC (0): You have learned Fishing
4000BC (0): Madrid has been founded
4000BC (0): Madrid has begun building a Warrior
4000BC (0): Research has begun on Meditation
3840BC (4): Madrid's borders have expanded
3720BC (7): Madrid has grown to size 2
3680BC (8): You have learned Meditation
3640BC (9): Research has begun on The Wheel
3640BC (9): Your Warrior has defeated a Barbarian Bear.
3560BC (11): Madrid has finished building a Warrior
3520BC (12): Madrid has begun building a Work Boat
3400BC (15): Madrid has grown to size 3

I'm not terribly fond of the repetition of year/turn. I could make it look something like this (let's call it Option 2):
Turn 0 (4000 BC)
You have learned Mysticism
You have learned Fishing
Madrid has been founded
Madrid has begun building a Warrior
Research has begun on Meditation

Or like this (Option 3):
4000 BC (Turn 0): You have learned Mysticism. You have learned Fishing. Madrid has been founded. Madrid has begun building a Warrior. Research has begun on Meditation.

Any thoughts on how to display the entries? I'm partial to Option 2.

Note: I didn't put in any custom messages, but they work nicely. And I really want to figure out a way to note when you snapped a screenshot and do most of the work for those (you'll still have to edit it to put in the links once you get them hosted, but I could make a tag with everything but the final url).

I should have a new version ready and posted tomorrow.
 
I love you man :cry:

I'll be a beta tester for you. :D

Option 2 is best. The other two are too cumbersome.
 
I'm partial to Option 2 also. Neither of the others gets me going at all. I'm gonna be using this all da time from now. Heh heh heh!

:D
 
Excellent work man! Notice you couldn't tear yourself away after midnight. Option #2 definitly looks the best. :goodjob:
 
Check the first post.... It's already uploaded.
 
@Gyathaar: Any chance I could see the source code for that? I'd like to know more about reading CIV save files.

@everyone: Funny story. I got up this morning, and after I read the posts I decided to quickly change the formatting to Option 2 and post the new version (beta, I guess) to let others play around with it until I get everything polished and then grab some breakfast. So I make the changes and start a game intending to play ~15-20 turns. But I got a really nice start so I played a bit more than that (to 50 BC :blush:). When I finally tore myself away from the game, I realized the log didn't look right. It ended up being much trickier than I thought to implement Option 2, but here it is (now well past lunchtime). One note -- the header at the beginning of each turn is printed when the game saves, which has two implications: 1. If you want a header every turn (which I assume you do) you need to have the game autosave every turn -- that's probably wise for SGs anyway; 2. If you save manually (or quicksave, I guess) during a play session, you will get extra turn headers. Hopefully I can fix these problems, but for now they seem like they're not too irksome.

Here is a sample log from a game (not the one that hooked me):
--------------Start of new log entries--------------
Turn 0 (4000BC)
Persepolis has been founded
Persepolis has begun building a Warrior
Research has begun on Animal Husbandry

Turn 1 (3960BC)
You have learned Animal Husbandry
Research has begun on Mining
hut gives AH

Turn 2 (3920BC)
Persepolis's borders have expanded

Turn 3 (3880BC)

Turn 4 (3840BC)

Turn 5 (3800BC)

Turn 6 (3760BC)
hut gives 40 gold

Turn 7 (3720BC)
You have learned Mining
Persepolis has grown to size 2

Turn 8 (3680BC)
Research has begun on Archery

Turn 9 (3640BC)
Your Scout has defeated a Barbarian Lion.

Turn 10 (3600BC)
scout injured to 0.4/1

Turn 11 (3560BC)
scout begins to heal on wooded hill
Persepolis has finished building a Warrior

Turn 12 (3520BC)
Persepolis has begun building a Barracks
warrior guarding persepolis
Note the custom log entries.

Beta of new version attached (I don't intend to change the first post until I get a more complete v2.0). The readme has not been updated, but the install works the same way. Additional notes added to eotinbLog.py. Hotkey for custom log echoes (echoes go to txt file, where entries go to in-game event log) is Alt+E.

Edit: first post updated, so I removed the file here.
 
Back
Top Bottom