[mod] Log changes

I have a question about inheritance. I understand what it is and mostly how to use it but I have one question about a specific situation. My example is not showing exact code but just a idea of the section of logic:

Code:
function [i]name[/i]:
  statement-1
  statement-2
  condition-1:
    /* I want to add logic here */
    more-statements
  rest-of-fuction-logic

Is there a way to do this with inheritance where I only need to put my code in the statement instead of a complete copy of the origional funciton?
 
weakciv: I think I get what you are trying to do, but to make sure, I'm going to paraphrase. Tell me if this is equivalent to what you are asking:
Code:
original funtion foo:
  do something
 
actually it is more like
Code:
Origional foo:
  o-foo-1
  o-foo-2

but I want to do
Code:
My foo(origional foo):
  o-foo-1
  my-foo-stuff
  o-foo-2

I want foo to do everything it did before but I want to put a single line of code within an if condition of an existing function bit I dont want to copy the entire function into my file just to add 1 line.
 
Dianthus said:
We've had a number of HOF players wanting to use this mod. We're looking to make a "HOF" mod that includes this and other mods that HOF users are particularly desperate for. I hope that's alright eotinb!

I've created new versions of CvEventManager.py/CvUtil.py based on the 1.52 versions that include the "OK" fix and DaveShack's fix mentioned by Methos above. I've attached these.

For the "HOF" mod we're also moving the paths/options out of the autolog.py into an .ini file as changes to .py count as asset changes when "No Cheating" is turned on. I think this is also going to be important for GOTM and the demogames as they're both interested in this mod.

[Edit]
Attachment removed due to bug. See post #278 below for a corrected version.
[/edit]


Check out my Succession Game Safe MOD Pack. I think it should be okay to use in HoF games as well.
 
weakciv said:
I have a question about inheritance. I understand what it is and mostly how to use it but I have one question about a specific situation. My example is not showing exact code but just a idea of the section of logic:

Code:
function [i]name[/i]:
  statement-1
  statement-2
  condition-1:
    /* I want to add logic here */
    more-statements
  rest-of-fuction-logic

Is there a way to do this with inheritance where I only need to put my code in the statement instead of a complete copy of the origional funciton?

Yes, if you don't want to affect or interact with the local variables of that function.

Here's an example:

Code:
class foo (bar):
  def func (self):
     statement-1
     statement-2
     condition-1:
        more-statements
     bar.func (self)

Basically, just call the parent version of the function after your additions. If you DO want to make changes to the local variables, then, I'm afraid you're going to have to copy over the whole function....

Req
 
thanks Req. That is pretty much what I thought. If i want to put something before/after the existing function code I can just call the origional after/before the new code. but if I want to put something in the middle of existing logic that requires variable data from that function at a specific point then I need to copy the whole function.
 
eotinb said:
@Dianthus: No problem using autolog or some kind of modified version for GotM.
Thanks eotinb. It's actually for the HOF, but GOTM might possibly maybe use it in the future. I've released the first version at http://hof.civfanatics.net/civ4/mod.php.



eotinb said:
As I said before, when I get home I'll post what I have so far in the way of a newer version and leave it to others to incoporate other changes (enter fix) and just clean everything up. The main advantage of the new version is that it uses proper inheritance to avoid the need to update autolog every time a new patch comes out.
That sounds interesting. An inheritance based version should make it much easier to keep up with new patches.



alerum68 said:
Check out my Succession Game Safe MOD Pack. I think it should be okay to use in HoF games as well.
Thanks alerum, I had a little look. The main problem we have in the HOF (and GOTM would have the same problem) is that we want the mod's .py to remain exactly the same so that the CRCs don't change. That means the user can't be allowed to edit the .py for configuration purposes. The biggest change we made in the HOF mod was the use of a .ini file for all of the configuration.
 
Another addition to this mod I would like to see is the message about a wonder being built elsewhere. The message appears in the screen at the top left but doesn't appear in the log file (either text log or game log). Anyone know how to add that?

Off to check out the HOF/GOTM log. I'm curious how it'll affect normal logs during non-HOF/GOTM games.
 
I have the exact same problem :
Methos said:
The message appears in the screen at the top left but doesn't appear in the log file

How do I get both logs consolidated automatically please ?
 
@Skyfish: As far as I know there is no way to make both the internal external logs exactly identical, short of the approach I am taking, which is to manually recreate every log event and echo that to the external log. But I decided to limit the event I echoed to the ones I though most important because replicating every one exactly would be more of a pain in the neck than I need.

@Dianthus: Sorry about the HoF/GotM mixup.

@Methos: Good idea. If no one else has tackled it by the time I am in the thick of things again, I'll take a look.

@all: Here is a zip file with my newest versions off all the files. Note that CvEventInterface.py in \entrypoints has been modified and CvEventManager.py is no longer altered (autologEventManager.py is used instead). As I said earlier -- I don't have the time to do this right, but I'd be grateful if someone else wanted to take these files and clean them up and make a proper new version, which I could link to up in the first post when I have some time.
 

Attachments

  • autolog.zip
    10 KB · Views: 171
While we are discussing feature requests, it would be nice if the combat results showed whether the unit was attacking or defending. No big deal if it isn't possible. Thanks!
 
All,
I can't get the logging program to function properly (it doesn't ask for the name of the autolog file and Alt-E doesn't work). I think the program is not initiating properly some how with patch 1.52 and the C4 GOTM 2 save file.

Autolog works fine when I load the GOTM 1 save file and a test save with patch 1.52. I have tried to clear the cache (shift held down entire time). I am going to try a quick reboot to see what happens. Any ideas?

Thanks,
ZG
 
With GOTM security the log no longer works with any GOTM saves. It worked fine with GOTM1 but thats it. If you check a normal game you'll notice it works fine with those.

In other words, we cannot use autolog with any current or future GOTM games. With any luck Ainwood and the rest of the GOTM Staff will allow us to use the HoF mod with GOTM.
 
Let me guess, the HoF mod was not enabled when the current CIV GOTM 2 was created. GOTM 2 has to be played completely vanilla and future GOTMs may allow the HoF mod?
 
ZapatoGrande said:
Let me guess, the HoF mod was not enabled when the current CIV GOTM 2 was created.
The HOF mod didn't even exist when GOTM2 came out!



ZapatoGrande said:
GOTM 2 has to be played completely vanilla
Correct.



ZapatoGrande said:
... and future GOTMs may allow the HoF mod?
"may" as in they are allowed. I'm not sure whether they will though, that's up to them. It would be best if you ask them over in the GOTM forum.
 
Great mod. One question and one observation.

Q: I hate getting prompted for the file name - how can I just have the autologger use the same file all the time?

O: I have renamed some of my units. When a unit with a name wins a battle it comes up as "UnitName (Warrior) wins ...". When a unit with a name loses it comes up as "Warrior losses ...".
 
Conroe said:
While we are discussing feature requests, it would be nice if the combat results showed whether the unit was attacking or defending. No big deal if it isn't possible. Thanks!

I am interested in this too!
I was hoping there would be a way to have combat results; victories (in blue) & defeats (in red).
Is this possible? It would be an asset to SG reporting, where you can see at a glance whether you are doing well or not.
 
Hi!

I'm working on the TAM project and we're having quite a problem... Always between 500bc and 50 ad, the AI does something and the game CTD, but without telling me nothing about the reason of the crash.. So I got no clue at all what's wrong... I tried to apply the Log Mod, so I could figure out what it is the AI is doing, but I dont get any autolog.txt file... I assume that its because the game crashes? Am I in error? And if it is the case, would there be a way to edit the py files so that I can get the logfile even with the crash?

Thanks for your help!
 
Top Bottom