[mod] Log changes

New revision in the works, including:
  • Minor correction to the error DaveShack pointed out above (and any others that make themselves known between now and whenever I finish up).
  • HTML color codes for hIdDeN_eViL (only because he's in China -- ni hui bu hui shuo Zhongwen?).
  • Subclassing, because it's a better way to do it and will eliminate annoying problems using my mods and other mods.
  • Screenshot semi-automation (described above).
 
eotinb said:
New revision in the works, including:
  • Minor correction to the error DaveShack pointed out above (and any others that make themselves known between now and whenever I finish up).
  • HTML color codes for hIdDeN_eViL (only because he's in China -- ni hui bu hui shuo Zhongwen?).
  • Subclassing, because it's a better way to do it and will eliminate annoying problems using my mods and other mods.
  • Screenshot semi-automation (described above).

:crazyeye: :goodjob: xie xie! wo ke yi shuo zhong wen. 谢谢!我可以说中文。

thx heaps!
 
I would continue my conversation in Chinese with hIdDeN_eViL (who I hope doesn't mind if I start using a less taxing capitalization method when writing his or her name from now on), but:
  • I don't know enough Chinese to talk about anything more interesting than studying Chinese (seems like that's all the introductory books teach you), and
  • Nobody else would care.
Anyway, can someone please tell me what hex HTML color codes match the vB colors I'm using? Or just point me to a place that lists the RGB values of the vB colors? I was going to get a best approximation from this site but my colorblindness would lead me to do something stupid like mix up brown and green or blue and purple.
 
eotinb said:
  • Minor correction to the error DaveShack pointed out above (and any others that make themselves known between now and whenever I finish up).

The bold and underline tags in turn headers are closed in the wrong order (you get <b><u>...</b></u>). The following change to the end of the autolog constructor fixes this.

Code:
        self.headerOpenTag = self.boldOpenTag + self.ulineOpenTag
        self.headerCloseTag = self.ulineCloseTag + self.boldCloseTag

  • HTML color codes for hIdDeN_eViL (only because he's in China -- ni hui bu hui shuo Zhongwen?).

The code below isn't pretty, but it does the job if you put it in the autolog constructor inside the if style == 1 block. If you want to get fancy, it might be nicer to use a class name instead of style, so you could attach a CSS stylesheet to the page, but that might be overkill.

Code:
            if (color == 1):
                self.blueOpenTag = '<span style="color: RoyalBlue">'
                self.blueCloseTag = '</span>'
                self.greenOpenTag = '<span style="color: Green">'
                self.greenCloseTag = '</span>'
                self.redOpenTag = '<span style="color: Red">'
                self.redCloseTag = '</span>'
                self.orangeOpenTag = '<span style="color: DarkOrange">'
                self.orangeCloseTag = '</span>'
                self.purpleOpenTag = '<span style="color: Purple">'
                self.purpleCloseTag = '</span>'
                self.brownOpenTag = '<span style="color: Brown">'
                self.brownCloseTag = '</span>'
                self.yellowOpenTag = '<span style="color: Yellow">'
                self.yellowCloseTag = '</span>'
 
eotinb said:
Anyway, can someone please tell me what hex HTML color codes match the vB colors I'm using?

Most (all?) browsers these days recognize a pretty large list of named colors including the ones used in vB code. In fact, if you take a look at the HTML source code for one of the posts in this thread where you've included colors, you'll see that it's just using the names directly. For example, take a look at this one:

http://forums.civfanatics.com/showpost.php?p=3359614&postcount=85

Edit: If you prefer hex colors (indeed, it would probably be better and more conformant to standards), you can get a nice list of all the X11 color names and their hex equivalents here:

http://blooberry.com/indexdot/color/x11makerFrameNS.htm
 
eotinb said:
I would continue my conversation in Chinese with hIdDeN_eViL (who I hope doesn't mind if I start using a less taxing capitalization method when writing his or her name from now on), but:
  • I don't know enough Chinese to talk about anything more interesting than studying Chinese (seems like that's all the introductory books teach you), and
  • Nobody else would care.

hehe, don't mind at all. everyone else seems to not bother and just go with lowercase straight off. actually, i don't know what i was thinking when i creatd the account name....makes loggin in hell...

and im glad for the chinese convo to die. im more fluent in english by far.

anyway. if you are subclassing, does that mean that changes to CvEventManager should be removed?
 
@Dr Elmer Jiggle: Thanks. And you even wrote the code for me -- how sweet. Thanks for catching the close tag order error too. I was careful to avoid this in my first edition but got sloppy somewhere down the line. It's nice to know that the vB named colors are just a subset of the HTML ones. And though it would indeed be more conformant to go with hex, I'm not that uptight and it would make it more difficult for other users to switch around the colors themselves (unless I added another layer by creating my own named colors set to the corresponding hex values, but if I wanted more busywork I'd get a real job).

@HiddenEvil:
HiDdEn-EvIl said:
....makes loggin in hell...
:lol: I bet.
HIDDEN_evil said:
anyway. if you are subclassing, does that mean that changes to CvEventManager should be removed?
Not yet. When v1.3 is released all you will have to do in your case (using another mod that alters CvEventManager.py) is replace the combined version of CvEventManager.py with the version from the other mod. You could go through and erase all the "autolog addition XX/XX" sections but that would be the hard way.
 
vbraun said:
Could we get something for when a civlization gets destroyed, please?
Should be possible. Let me look into it. No promises that this will make it into the upcoming revision, though. Good catch, by the way. This is a pretty big missing feature since you mention it.
 
Doc, I know next to nothing about CSS. As the main purpose of this mod (for me at least) is SGs, most of my focus has been on ease of use for vB code users. But I'm very interested in stylesheet functionality as a future direction.

And since I have the attention of all you guri, anyone have any ideas on how to make the path implementation less klunky and trouble-prone? What I'd like to do is have the default setting be ...\SM's Civ4\Saves but I don't know how to get around the fact that part of that directory chain is machine-dependent (the full path being "C:\Documents and Settings\Owner\My Documents\My Games\Sid Meier's Civilization 4\Saves" on my machine and at least the drive and the "Owner" part are very likely to be different for other people).
 
eotinb said:
Doc, I know next to nothing about CSS. As the main purpose of this mod (for me at least) is SGs, most of my focus has been on ease of use for vB code users. But I'm very interested in stylesheet functionality as a future direction.

You should probably use <div ...> instead of <span ...> as I had in my code. That will make each entry naturally occur on a new line. Without that, you need to do the breaks manually somehow. For similar reasons, it would probably be useful to enclose the header in a div as well, resulting in HTML something like this.

Code:
<div><b><u>Turn 1 ...</u></b></div>
<div style="color: red">some combat occurred</div>
<div style="color: purple">something was built</div>

Now if you wanted to get fancier and use CSS, you'd wind up with HTML more like this.

Code:
<h2>Turn 1 ...</h2>
<div class="combat">1 for combat (wins, losses, promotions, war [if I can get this to work])</div>
<div class="build">1 for builds (units, buildings, projects)</div>
<div class="city">1 for city stuff (founded, growth, razed, borders, acquired, lost [last two coming soon!] -- may get combined with previous)</div>
<div class="religion">1 for religion (founded, spreads)</div>
<div class="technology">1 for technology</div>
<div class="other">1 for everything else (tribal village, golden age, great people -- may get combined with previous)</div>

Then you'd attach CSS (at the beginning of the file) that looks something like this.

Code:
<style  TYPE="text/css">
    <!--
    h2 { font-weight: bold; text-decoration: underline; margin-top: 2ex; margin-bottom: 0; }
    .combat { color: red; }
    .build { color: purple; }
    .city { color: RoyalBlue; }
    .religion { color: DarkOrange; }
    .technology { color: green; }
    .other { color: black; }
    -->
</style>

Strictly speaking, the HTML file should probably have the full <html><head><title>...</title><style>...</style></head><body>...</body></html> structure, but that's not really necessary with most browsers, and it would present problems with appending to a running log, since you never really know when the log is "finished." In practice, simply putting the stylesheet at the beginning of the file is sufficient.

This is all probably a lot more complicated than it needs to be for succession games, but just FYI. You can decide how much or how little of it you actually want to do. ;) Personally, I'm most interested in it just to get better information out of the in-game event log (especially city growth; I can't believe they left that out of the standard event notifications), so I'm eagerly awaiting your new notifications mod. Especially now that you removed all the event log stuff from this one. :)
 
Edit: Thanks for the CSS primer.
Dr Elmer Jiggle said:
You should probably use <div ...> instead of <span ...> as I had in my code.
Right-o.
Dr Elmer Jiggle said:
Personally, I'm most interested in it just to get better information out of the in-game event log (especially city growth; I can't believe they left that out of the standard event notifications), so I'm eagerly awaiting your new notifications mod. Especially now that you removed all the event log stuff from this one. :)
Yeah, after I did that I realized there was a bit of a hole where the city growth bit notification had been. Were I working more diligantly on the notifications mod, the hole would be filled. But as it is, every time I have some time I find myself playing instead of working on the notification thing. That's why I did that simple reminders mod, in part to fill the gap (although it's certainly not as elegant for purposes of monitoring city growth as the automatic feature). Alternatively, it would be pretty trivial to add the city growth notification code back in. In fact...
 
Until I finish the notifications mod (no idea when that will be), I'm posting the code that notified you of city growth in the in-game event log for those that want to put it back in. The following two lines should go in the onCityGrowth() function in CvEventManager.py after the line that begins "CvUtil.pyPrint" (which would be line 686 in the unmodified 1.09 version):
Code:
message = "%s grows: %i" %(pCity.getName(), pCity.getPopulation())
CyInterface().addMessage(pCity.getOwner(), True, 30, message, 'AS2D_ALARM', 2, 'Art/Interface/Buttons/Actions/foundcity.dds', ColorTypes(11), pCity.getX(), pCity.getY(), True, True)
Note that the sounds that plays is the same alarm sound from my reminders mod. If you don't like it just change 'AS2D_ALARM' in the second of the above lines to None.
 
eotinb said:
Not yet. When v1.3 is released all you will have to do in your case (using another mod that alters CvEventManager.py) is replace the combined version of CvEventManager.py with the version from the other mod. You could go through and erase all the "autolog addition XX/XX" sections but that would be the hard way.
nope... looks like i'll have to do it the hard way. i've merged your reminder thingy as well. and changed the codes to the other mod thats merged in.

o well, at least with subclassing future updates will be a breeze.


do you have an eta on you next release?
 
@HiddenEvil: I hate to make promises and not keep them, but I will let you know that I was shooting for tomorrow. Earliest something like 12 hours from now but if subclassing is more trouble than I expect, it could take longer. I think within the next day or two is reasonable.

@Doc: Would it be inelegant or otherwise inadvisable to use the span tags as you originally posted and nest them inside div tags? Because I was thinking of something like:
Code:
if (style == 1):
   revisedMessage = "<div>%s</div>" % (logMessage)
   logMessage = revisedMessage
 
eotinb said:
Would it be inelegant or otherwise inadvisable to use the span tags as you originally posted and nest them inside div tags? Because I was thinking of something like:
Code:
if (style == 1):
   revisedMessage = "<div>%s</div>" % (logMessage)
   logMessage = revisedMessage

Maybe slightly inelegant, but I wouldn't say inadvisable. If it works, it works! ;)

FWIW, my current local copy uses <div style="color: foo"> for the event color tags and <h3> for the "bold open tag." I'm guessing that solves the same problem you're working on (that is, getting the header surrounded by a div without impacting the vB code side of the fence). Whether it's better, worse, or the same as your approach is debatable.

BTW, thanks for the in-game event log code. I had been trying to figure it out myself, but I haven't found any documentation nor the source code for CyInterface, so it's no surprise that I wasn't getting anywhere.
 
eotinb said:
@HiddenEvil: I hate to make promises and not keep them, but I will let you know that I was shooting for tomorrow. Earliest something like 12 hours from now but if subclassing is more trouble than I expect, it could take longer. I think within the next day or two is reasonable.
in that case, dont rush anything on my account. after this evening i wont have net access until .... very late sunday.
 
Req, you will be happy to hear that I have completed the conversion to a proper inherited class structure. It was a bit tricky, but nothing I couldn't handle (he says before all the bug reports come streaming in). I'm still having trouble with recognizing when PrtScn is hit -- at first I thought the keyboard event is consumed wherever in the code the screenshot is stored, but then I realized that with my code in, the screenshots I took were different (specifially, they were tga format but still had the .jpg extension and didn't have any interface) and as soon as I commented out my code it worked as before. But I never got my placeholder code (just a simple message to the in-game screen to let me know it was working) to trigger. I'll work with it a bit more and if I make no more headway, release the new version without it later today.

I'm also looking for some help on implementing vbraun's request on noting when a civ is destroyed, in particular:
  • It would be much easier if I could make this event-based. This means I need to figure out all of the events that could be triggered at the same time that a civ is eliminated (since there is no specific onCivEliminated() or similar event). From what I have read, a civ is eliminated when they lose their last city, regardless of if they have any units left (I think that's one of the hints that shows when the game is loading). This would mean that a civ with a settler out and about that loses its last city is gone even though it could found a new city with the settler. So I guess I have two questions:
    1. Can anyone confirm that what I have just described (regarding settlers) is true?
    2. Are there other events that could fire at the same time a civ is eliminated besides losing a city? I think onCityLost() is fired every time onCityRazed() is, so there shouldn't be a need to check in both of those functions, but there may be some other way a civ is eliminated that I'm forgetting. Maybe if they lost their first settler before it founded the first city, although I can't see that ever happening. Something else?
  • Should the log only note when a civ you know is destroyed? If not, should you be told the name of the dead civ if you haven't met them? In other words, as I see it there are three options when a civ you don't know is destroyed (you are always told who died when the eliminated civ is one you know):
    • You don't hear about it
    • You get a message like "An unknown civ has been destroyed"
    • You get a message like "The Aztecs have been destroyed"
 
eotinb said:
Can anyone confirm that what I have just described (regarding settlers) is true?

It wasn't true in Civ3 (that is, in Civ3 if you had a settler you were still in the game), but it's certainly possible that they changed it in CivIV.

  • You don't hear about it
  • You get a message like "An unknown civ has been destroyed"
  • You get a message like "The Aztecs have been destroyed"

I think B or C makes the most sense. You aren't giving away any information by announcing the destruction itself. You could always look at the victory conditions screen to see how many rivals are left in the game.

As for the name, that's a tougher call. Theoretically once they're eliminated it really doesn't help you to know who it was, so you might as well say the name just for the sake of interesting background information. On the other hand, if it doesn't help you, then why mention it? In other words, if it's not useful to know that it was the Aztecs, then you should be just as happy to know that it was "Unknown civilization." I'd say go with B unless someone can come up with a compelling reason why C is better.

You could actually make a case that knowing the civilization's name would, in fact, help you out. Knowing what traits and unique units were in play might tell you something about the remaining civilizations. For example, you might deduce that if the eliminated civilization had a strong unique unit in the current era, then the enemies might be weak from the war. Or you might be able to make a guess about which wonders and holy cities the conquerers took over. It's a stretch, but better to avoid the issue and just leave it as unknown.
 
Back
Top Bottom