1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Mod to log events to file possible?

Discussion in 'Civ5 - Creation & Customization' started by syndicatedragon, Sep 11, 2011.

  1. syndicatedragon

    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.
     
  2. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    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.
     
  3. syndicatedragon

    syndicatedragon Warlord

    Joined:
    Nov 14, 2003
    Messages:
    135
    Location:
    St. Louis
    How do you turn on Lua.log?
     
  4. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    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.
     
  5. syndicatedragon

    syndicatedragon Warlord

    Joined:
    Nov 14, 2003
    Messages:
    135
    Location:
    St. Louis
    Excellent, thank you very much.
     

Share This Page