Mod to log events to file possible?

syndicatedragon

Warlord
Joined
Nov 14, 2003
Messages
135
Location
St. Louis
Is it possible to write a mod that will write events to a text file? Either that or I would like a way to dump the notification log from a replay to a file. This would be very helpful in writing AARs.
 
The Lua.log already records everything displayed in FireTuner, so that should be a good starting point as most of the events trigger some sort of message there. As long as you turn it on, that is. The big advantage of this is that any Lua code you write will also dump here automatically, so if you want to add, say, a start-of-turn event that prints out player names, scores, etc., it's a ready-made replay text file.
 
It might be on by default, I can never be sure, but you should do the following anyway:

1> Find your user directory. In Windows 7, that'll be My Documents/My Games/Sid Meier's Civilization V/. Other operating systems might be different, but it shouldn't be too hard to find.
2> In that file is the Logs directory (containing these log files), Maps, MODS, and so on. It's a good idea to know where all of these are, for later use. But also in this directory is a file named "config.ini". Open this; it's raw text, so notepad works fine.
3> A few lines in is "EnableTuner=0". Turn that to a 1 if you ever want to use FireTuner (which you will at some point).
4> About two-thirds of the way down the file, you'll see "LoggingEnabled=0" or something similar. Change that to a 1. Then, look for every other line in that file with the word "Log" or "Logging" involved; if any of those sound interesting, turn them on as well. There are a lot of these; Event logging, AI decision logging, et cetera.
5> Run the game. Some of the files, like Database.log, seem to be mainly generated at the point you load the game, but others, like xml.log, are generated when a mod is activated. Lua.log is simply a text dump of every FireTuner message, which means it's constantly being added to.
 
Top Bottom