Logger

ruff_hi

Live 4ever! Or die trying
Joined
Oct 24, 2005
Messages
9,135
Location
an Aussie in Boston
I've been working on the logger with regards to gaining techs. There are a number of ways of gaining techs ...
  • research
  • player initiated trade
  • AI initiated trade
  • huts
  • espionage
  • lightbulb
  • peace deals
  • AI gifts
  • the internet
  • partner research
  • any others?

There are 3 phases that the logger can differentiate ...
  • human playing
  • just after human ending turn
  • AI turns

The logger tries to line these two lists up, but fully identify the methods of gaining techs. As such, there are only limited messages that the logger can provide ...
  • Tech research finished (research)
  • Tech acquired (all others)

The logger can also identify player initiated trades and will log techs that the AI gains from trade. Unfortunately, the logger cannot identify AI initiated trades and will just log one side of the tech trade (player gaining techs).
 
The logger now only shows the following if there is actually something to log ...
  • turn starts
  • After End Turn
  • Other Player Actions

Example ...

Logging by BUG Mod 3.0 [Build 1000] (BtS 3.13-3.17)
------------------------------------------------
Turn 0/500 (4000 BC) [17-Jul-2008 00:58:52]
Rome founded
Research begun: The Wheel (7 Turns)
Rome begins: Barracks (50 turns)

Turn 1/500 (3960 BC) [17-Jul-2008 00:59:11]
Tribal village results: a little gold

Turn 4/500 (3840 BC) [17-Jul-2008 00:59:21]
Rome's borders expand

Turn 5/500 (3800 BC) [17-Jul-2008 00:59:25]
Tech research finished: The Wheel
 
any others?

  • The Oracle
  • Liberalism
I don't know if this will be helpful for you, but my most recent changes to CvCustomEventManager fixed the EndTurnReady event so that it fires now (existing event was never fired by Civ4), and I added a BeginActivePlayerTurn event that first as soon as the player can start taking their turn. BeginPlayerTurn fires as usual after the human has clicked the "End Turn" button.
 
  • The Oracle
  • Liberalism
I don't know if this will be helpful for you, but my most recent changes to CvCustomEventManager fixed the EndTurnReady event so that it fires now (existing event was never fired by Civ4), and I added a BeginActivePlayerTurn event that first as soon as the player can start taking their turn. BeginPlayerTurn fires as usual after the human has clicked the "End Turn" button.
Thanks for those two. And yes - the beginactiveplayerturn would be useful. At moment, the logger is backing into that by assuming the active player is always #0.
 
Are you planning to make this mod compatible for use with other languages?
 
Are you planning to make this mod compatible for use with other languages?

This was requested by Cammagno a few posts up. If I'm not mistaken, the Logger is the only place with non-translatable text left in BUG. If there are others, please point them out so we can fix them.
 
This was requested by Cammagno a few posts up. If I'm not mistaken, the Logger is the only place with non-translatable text left in BUG. If there are others, please point them out so we can fix them.

OK, here's one ;)

I made your era-part of CvMainInterface translatable.

Code is in the attached file. And add in an xml-file following code (the german translation is correct :) ) :
PHP:
    <TEXT>
        <Tag>TXT_KEY_BUG_ERA</Tag>
        <English>%s1 Era</English>
        <French>%s1 Era</French>
        <German>%s1</German>
        <Italian>%s1 Era</Italian>
        <Spanish>%s1 Era</Spanish>
    </TEXT>
 

Attachments

The translatable log entries are great. :goodjob:
However, I encountered two bugs when I played a few turns and logged them. (Not sure if they are only related to the German log entries.)

An Example:
Bei der Verteidigung in mongolischem Hoheitsgebiet bei Sir Orda wird ein Bogenschütze von einem %s3 Schwertkämpfer (3.30/6) besiegt (Siegwamongolischheinlichkeit: 4.2 %)

As you can see the %s3 variable isn't used altough the civ's adjective is displayed ("mongolisch"). It's just in the wrong place in the middle of the "Siegwahrscheinlichkeit" (eng. "Prob victory"). :D

I also marked the % at the end of the parenthesis because you are apparently using another variable to display it. AFAIK, you could achieve the same effect by using something like this: "%s7%". (If you have to do it this way for coding reasons then just ignore this paragraph. :) )
 
The translatable log entries are great. :goodjob:
However, I encountered two bugs when I played a few turns and logged them. (Not sure if they are only related to the German log entries.)

An Example:


As you can see the %s3 variable isn't used altough the civ's adjective is displayed ("mongolisch"). It's just in the wrong place in the middle of the "Siegwahrscheinlichkeit" (eng. "Prob victory"). :D

Strange thing... in my test with ITA I had no problem with it, but maybe it escaped to my check, so i'll test again that specific case: to be sure, that case is the "While defending, loses", right?

I also marked the % at the end of the parenthesis because you are apparently using another variable to display it. AFAIK, you could achieve the same effect by using something like this: "%s7%". (If you have to do it this way for coding reasons then just ignore this paragraph. :) )

I don't know, I left it as it was in the original Python code, maybe if I put in the XML file the % sign it will be understood without problems when it is called by python, but I have very little knowledge of python, so I prefered to change the less as possible :)
 
Strange, I'm not able to reproduce the bug... not in ITA, not in ENG and it seems also not in DEU... but I'm not sure I tested your specific case, due to my difficulty to understand the DEU text you have posted... i get these four, please check if one of them covers your case.

Beim Angriff auf in the wild near Aachen besiegt ein Deutscher Panzer (28.00/28) ein Heilig-römisch Krieger (Siegwahrscheinlichkeit: 100.0 %)

Beim Angriff auf in the wild near Aachen wird ein Bogenschütze von einem Heilig-römisch Deutscher Panzer (28.00/28) besiegt (Siegwahrscheinlichkeit: 0.0 %)

Bei der Verteidigung von in the wild near Aachen besiegt ein Deutscher Panzer (22.40/28) ein Heilig-römisch Deutscher Panzer (Siegwahrscheinlichkeit: 52.2 %)

Bei der Verteidigung von in the wild near Aachen wird ein Krieger von einem Heilig-römisch Deutscher Panzer (28.00/28) besiegt (Siegwahrscheinlichkeit: 0.0 %)

If not, tel me about which case it is :)

If yes, I don't know what to say... I'm using the last version of the file in SVN, but I have not touched the DEU lines, so if I fixed that bug, it was without knowing about it :D
 
Thanks, mate. :)
It turned out that it was a fault on my side. :blush: I didn't replace the BUG Mod folder (the one with the INIs and stuff) when I copied the most recent version to my Mods folder. Now everything looks like it should be. :D

Oh, and the % instead of the variable works OK if you want to use it. :D
 
Thanks, mate. :)
It turned out that it was a fault on my side. :blush: I didn't replace the BUG Mod folder (the one with the INIs and stuff) when I copied the most recent version to my Mods folder. Now everything looks like it should be. :D

Ok, the important thing is that the problem is solved :)

Oh, and the % instead of the variable works OK if you want to use it. :D

Ok, in future I'll use them for sure, it's a better way for sure

I've just finished to export all that long py file to XML, so it's ready in SVN for your DEU lines :crazyeye:
I also did a bit of testing, but I've not yet tested each event, some of them are long to reproduce in game... I'll do.
Anyway, if you find that I missed something (or that something is wrong), fell free to tell me or even to add it yourself. :)
 
If you're asking if you can put a % into the XML text directly, this should work by using two together: %%. If that's not what you're talking about, please explain. :)

Thanks for this, Cammagno. This type of repetitive work is the kind that I most dislike and am most likely to make an error doing. I'm currently doing something similar converting all the Bug*Options.py files to XML. Luckily I was able to build a regular expression (find/replace) that does most of the work.

I wonder if there would be much serious interest in moving the message colors to an INI so users could configure them easily. Any Autolog users care to weigh in on that feature?
 
If you're asking if you can put a % into the XML text directly, this should work by using two together: %%. If that's not what you're talking about, please explain. :)

Yes, I know a bit of XML, so I knew it. The thing that I didn't knew was if python was able to understand this double %% convention, so to avoid problems i left the things as they were (that is a variable calling lPercent).
I'm happy to know that the double %% is working with python (from inside an XML, I mean), so for sure in the future I'll use this way.

Thanks for this, Cammagno. This type of repetitive work is the kind that I most dislike and am most likely to make an error doing.

I also don't like so much repetitive work (I'm always tring to find a macro or a regexp for this type of works), but on the other side i think that a bit of rep work is a good exercise when I'm trying to learn something :)

I wonder if there would be much serious interest in moving the message colors to an INI so users could configure them easily. Any Autolog users care to weigh in on that feature?

I have to confess that just while I was making this XMLization work, I was thinking about this possibility...
 
I have to confess that just while I was making this XMLization work, I was thinking about this possibility... [moving colors to INI]

This would make a good task for you to try out some Python skills after going through the tutorials and I have completed the core rewrite.
 
I was playing a game the other day and I had one city running 22 artists specialists. It had the National Epic (Artist) as well as the National Park (scientist) so I was generating lots and lots of Artist GPPs. Well, would you believe it, but at a reported probability of under 1%, I actually generated a Great Scientist from this city.

I've just thought that this information should be included in the logger - each turn, the logger scans through your cities and records the probabilities when there is 1 turn until a GP pops. Then, in the message about so-and-so being born, it includes the probabilities.
 
That's a great idea, and it can be added to the BeginPlayerTurn so that it's totally accurate. This event fires after the player has hit "End Turn" but before any of the DLL code runs that would birth a GP.
 
Back
Top Bottom