Bug Reporting

I have fixed and committed the PLE problems in MainInterface:

  • Air units now have hovers with correct strength.
  • Units that have used all of their movement points this turn show 0.0 instead of full movement.
  • Calls to setXY() when selecting units using alt and/or ctrl have been fixed.
 
RE: Foreign Advisor displaying wrong favorite civics under Random Personalities.

I like this. It is certainly better than displaying false information as happens now.
Attached is a foreign advisor (based on rev 1122) which refuses to display the favorite civic if random personalities is on; a similar thing should probably be done for the standard advisor in the unofficial patch. That will take care of removing erroneous information while further discussion on enhancements continues below. ;)

continued... said:
Even better would be to change it to the actual civic once the user has seen the information. For example, if you switch to Bureaucracy and suddenly get a +1 diplomatic bonus from Monty, you know that's his favorite civic (and will be all game). Unfortunately, the game doesn't give any sort of event for this.

We could check the diplo modifiers every time the player changes civics (and the AIs too, if my memory is correct that they must be running it as well to get the modifier). This would be quite easy, save for detecting the actual diplo modifier entry given that they aren't available programmatically.
Detecting the modifier isn't too hard if we can make the assumption that everything between the quotes of the defined string will be listed in the diplo summary. For example I ran the following check in a BeginPlayerTurn handler on an in-progress game where I shared the favorite civic of 3 AIs (Hannibal, Boudica, and Suryalphabet) and did not share it with 5 others.
Code:
                    CvUtil.pyPrint(" -- Testing Against Player %d - %s" %(iOtherPlayer, pOtherPlayer.getName()))
                    szDiplo = CyGameTextMgr().getAttitudeString(iOtherPlayer, iPlayer)
                    pMatch = re.match("^.*(\".+\")", localText.getText("TXT_KEY_MISC_ATTITUDE_FAVORITE_CIVIC",(0,)))
                    for szMatch in pMatch.groups():
                        if szMatch in szDiplo:
                            CyInterface().addMessage(iPlayer, False, gc.getEVENT_MESSAGE_TIME(), "You are running the favorite civic of %s" %(pOtherPlayer.getName()), None, InterfaceMessageTypes.MESSAGE_TYPE_INFO, None, gc.getInfoTypeForString("COLOR_BLUE"),0,0,False,False)
                            CvUtil.pyPrint("      YES!")
                        else:
                            CvUtil.pyPrint("      NO!")
I'm using a regexp to extract the part of the modifier text that's between the quotes and then running a substring test between that and the full diplo string. And the results:
Code:
PY:DEBUG Running Favorite Civic Test for Player 0 - SpreadCultureTesting
PY: -- Testing Against Player 1 - Huayna Capac
PY:      NO!
PY: -- Testing Against Player 2 - Boudica
PY:      YES!
PY: -- Testing Against Player 3 - Hammurabi
PY:      NO!
PY: -- Testing Against Player 4 - Elizabeth
PY:      NO!
PY: -- Testing Against Player 5 - Zara Yaqob
PY:      NO!
PY: -- Testing Against Player 6 - Ragnar
PY:      NO!
PY: -- Testing Against Player 7 - Suryavarman II
PY:      YES!
PY: -- Testing Against Player 8 - Hannibal
PY:      YES!
PY: -- Testing Against Player 18 - Barbarian
PY:      NO!
If that modifier appears after a civics change we then have to see which civics match (you are right that both must run it) and assume that the favorite is one of those. If more than one matches, further civics changes must be monitored to whittle it down but we could probably list all the choices as "possibles" until then.

So how do you store and retrieve data to keep track of this stuff?

EDIT: Attachment removed as EF merged into BUG
 
Attached is a foreign advisor (based on rev 1122) which refuses to display the favorite civic if random personalities is on.

Committed.

Detecting the modifier isn't too hard if we can make the assumption that everything between the quotes of the defined string will be listed in the diplo summary.

This would make an excellent addition to AttitudeUtils.py:

Code:
def hasModifier(attitudeText, xmlKey) -> boolean

if AttitudeUtils.hasModifier(szDiplo, "TXT_KEY_MISC_ATTITUDE_FAVORITE_CIVIC"):
    ...

And I bet we could find good uses for one that splits the text apart into all of the modifiers:

Code:
def getModifiers(attitudeText) -> dict { string xmlKey: int modifier }

If that modifier appears after a civics change we then have to see which civics match (you are right that both must run it) and assume that the favorite is one of those.

Assuming the attitude modifier doesn't appear immediately, you could track all civics switches over time . . . hmm, actually you couldn't really. Say you switch from A to B, 10 turns later from X to Y (different categories), and 10 turns later you get a modifier. Is B or Y their favorite civic?

In any case, you're right that we can narrow it down to a list of possibles. I believe the modifier disappears immediately upon a switch away, so that would help too. Also, will the AI ever ask you to switch to a non-favorite civic, or can we assume that a request to switch civics will always be to a favorite?

So how do you store and retrieve data to keep track of this stuff?

SdToolkit, already included in BUG for UnitNaming and Reminders. You can register a "mod" key (e.g. "FavoriteCivics") with SdToolkit and then attach any structured data you want (from a simple int to a complex class with lists and dictionaries and other data types).

We'd need to track the set of possible favorite civics for each AI as well as the history of civics changes for the player and any AIs for whom we are unsure of their favorite.

You can start by skipping the saving of data and just code up the checks. Go ahead and check each turn as well for the modifier change as I think it's not immediate. I do know that it grows over time, but if it turns out to show up immediately, this gets a whole lot easier. :)

On a slightly related note, I had originally added a feature to the EFA for my personal copy of Ruff's mod (may the hard drive that held it rest in peace): each civic that you shared in common with an AI was highlighted (just need to call setSelected() (IIRC) on the GFC checkbox. I also added the player as the first row on that INFO page.

Also, I put a * next to an AI's religion if you shared it and a * next to their favorite civic if you shared that.

Finally, for trade I hid the 0 if you could not possibly trade with them (not connected or at war). Now that we have a war icon, we could even add the reason instead of simply hiding the 0 value.

Wanna take a stab at any of these?
 
Assuming the attitude modifier doesn't appear immediately, you could track all civics switches over time . . . hmm, actually you couldn't really. Say you switch from A to B, 10 turns later from X to Y (different categories), and 10 turns later you get a modifier. Is B or Y their favorite civic?

In any case, you're right that we can narrow it down to a list of possibles. I believe the modifier disappears immediately upon a switch away, so that would help too. Also, will the AI ever ask you to switch to a non-favorite civic, or can we assume that a request to switch civics will always be to a favorite?
I'm pretty sure the attitude modifiers appear and disappear immediately. When I was testing to verify that the favorite civics were not what was shown when running Random Personalities, I was using CyPlayer::setCivics in the Python Console to change myself back & forth between OR and Theocracy and then hovering over the scoreboard names for the other leaders. +1s were appearing and disappearing right away.

And I'm fairly certain that they will only ask you to switch to their favorite civic. At least, I've never had one ask me otherwise.

continued... said:
SdToolkit, already included in BUG for UnitNaming and Reminders. You can register a "mod" key (e.g. "FavoriteCivics") with SdToolkit and then attach any structured data you want (from a simple int to a complex class with lists and dictionaries and other data types).

We'd need to track the set of possible favorite civics for each AI as well as the history of civics changes for the player and any AIs for whom we are unsure of their favorite.

You can start by skipping the saving of data and just code up the checks. Go ahead and check each turn as well for the modifier change as I think it's not immediate. I do know that it grows over time, but if it turns out to show up immediately, this gets a whole lot easier. :)
Oooh. SdToolkit sounds very handy. I'll try and think up a decent way to track these guys. And as stated above, I'm pretty confident a +1 will show up immediately.

continued... said:
On a slightly related note, I had originally added a feature to the EFA for my personal copy of Ruff's mod (may the hard drive that held it rest in peace): each civic that you shared in common with an AI was highlighted (just need to call setSelected() (IIRC) on the GFC checkbox. I also added the player as the first row on that INFO page.
Neat ideas. I like having the first row be yours; I have been toying with the idea of throwing the small civics icons you see at the top of the diplomacy window somewhere on main interface so that I could quickly tell what I was running. Yeah, I'm actually too forgetful to keep track and too lazy to hit F3 all the time. :p

continued... said:
Also, I put a * next to an AI's religion if you shared it and a * next to their favorite civic if you shared that.

Finally, for trade I hid the 0 if you could not possibly trade with them (not connected or at war). Now that we have a war icon, we could even add the reason instead of simply hiding the 0 value.

Wanna take a stab at any of these?
Good stuff. For the trade thing, either them or you running Mercantilism could be another special case for zeros.

I think I'll play around with the favorite civic detection. I've always liked the idea that your advisors should be learning from what's going on. :)
 
I'm pretty sure the attitude modifiers appear and disappear immediately. When I was testing to verify that the favorite civics were not what was shown when running Random Personalities, I was using CyPlayer::setCivics in the Python Console to change myself back & forth between OR and Theocracy and then hovering over the scoreboard names for the other leaders. +1s were appearing and disappearing right away.

Okay, I thought so too but just don't pay close enough attention. Let me know if you have any questions about SdToolkit. If you look at Reminders, you should be able to copy its usage closely.
 
Small bummer with the favorite civic attitude change detection: there is no Civ event when a player changes civics. A message is displayed on-screen, but no Python event is triggered. :(

Looks like you'll have to stick to checking each turn (BeginActivePlayerTurn seems like a good spot). You can check when the INFO page is drawn to catch when you've changed your own civics to a favored one.
 
My unit-naming script screams for an event when units are upgraded too.

Yes, we wanted to add an option to rename units when they are upgraded as well. It looks goofy seeing "Warrior 1 of Rome (Rifleman)". :mad:
 
Small bummer with the favorite civic attitude change detection: there is no Civ event when a player changes civics. A message is displayed on-screen, but no Python event is triggered. :(

Looks like you'll have to stick to checking each turn (BeginActivePlayerTurn seems like a good spot). You can check when the INFO page is drawn to catch when you've changed your own civics to a favored one.
Getting there: (links to full-size)

Still need to work in the save/load stuff with Sdtoolkit. The main question is how can we pretty it up? This screen has always been a little ugly to me and this makes it worse. :p I'm thinking a smaller text string (at least in English) than "Possible Favorite Civics" will help both in lining up with the ones we've discovered and for staying on the screen for those folks that don't play at my beloved widescreen resolution. Also, should the guys that we can't even guess at say anything like "unknown" or just remain blank?

p.s. The more I see of BUG's internals, the more impressed I am with what you guys have accomplished. :goodjob:
 
The main question is how can we pretty it up? This screen has always been a little ugly to me and this makes it worse.

Agreed on both points. If you wanna go nuts, you could use IconGrid to rework the entire screen. This would give you the ability to line up columns and put headers where they belong: at the top of the list.

There are two downsides to IconGrid that I'm aware of: 1) no scrollwheel :( and 2) the civic icons can't be highlighted as I had done in my other version of this screen. I don't think either of those is enough to stop from switching to it. Take a look at Ruff's Sit-Rep page for sample code and of course the EFA tech/resource trade pages. You only need to use IconGrid_BUG to get stacked bars, but it wouldn't hurt to use it anyway.

Also, should the guys that we can't even guess at say anything like "unknown" or just remain blank?

I'm sure we could talk NikNaks into drawing a question mark icon for us. It would be useful in the BUG MA too when you don't know the strategic advantages of an AI (rather than the current "N/A" icon).

p.s. The more I see of BUG's internals, the more impressed I am with what you guys have accomplished. :goodjob:

Thanks! . . . Uh, that was a compliment, right? :lol:
 
The main question is how can we pretty it up?

If you wanna go nuts, you could use IconGrid to rework the entire screen. This would give you the ability to line up columns and put headers where they belong: at the top of the list.
I would suggest that you take a look at the glance screen (top panel for headings, big panel for AI civics - thus auto scroll bar). Which screens like this where the contents are largely uniform (ie always 5 icons for civics), the icongrid is not required. Using panels with different styles will give you a screen that looks much better than the current version.
 
@Dresden - Let's move this discussion to a new thread. Can you please start a thread about the new Info page when you next post?

Also, I found the files that had my fixes for Ruff's EFA. I seem to have found two versions, and I'm not sure how. In any case, take a look at EFA in New and From CFC, comparing them to each other and/or Old (original). The files in From CFC I found in a private message I sent to someone here that wanted the fixes. The ones in New came from somewhere else (I don't remember).

There are two main fixes, pretty well separated in the file. First is what I mentioned above: player is first Info row, hide 0 trade when cannot trade, * after same religion and * after favorite civic if player is running it.

The other is a fix to the Glance page when the active player is not player zero (scenarios). This page has changed more than the Info page and will be harder to integrate easily.

I'd love to see them all ported to BUG, but obviously do what is fun for you. :)

You can ignore the MainInterface file as it's fix is already in BUG.
 
Cool thanks. I was actually going to turn the Info thing into a new thread yesterday when I hit a stumbling block in the coding... but in the process of creating the post I figured out my problem and so never got around to it. I'll start off onto a new topic the next time I have something useful to say about it. :)
 
edit: oops

At least I will fix the disappearing units aspect of the MA for 3.1

it seems, the following MA bug is already known :mischief:



meh, just noticed another bug. the MA is often not showing all (own) units:

attachment.php


attachment.php
 
I'm sure we could talk NikNaks into drawing a question mark icon for us. It would be useful in the BUG MA too when you don't know the strategic advantages of an AI (rather than the current "N/A" icon).
Actually, what about one of these ... :dunno:
 
there is another scoreboard bug (maybe caused by 3.17, maybe caused by BUG, don't know)

you can't see on the scoreboard other war opponents and the worst enemy of anyone you are at war with.

'your enemy'

at war with: you (missing), opponentX (missing), opponentY (missing), ...
worst enemy of: anyone (missing) <- well, this is not relevant at war, but you should see other opponents
 
there is another scoreboard bug (maybe caused by 3.17, maybe caused by BUG, don't know)

you can't see on the scoreboard other war opponents and the worst enemy of anyone you are at war with.

Do you mean the hover text showing the various diplomatic modifiers and who is a vassal of whom that appears when you hover over a scoreboard entry? That isn't created by BUG; the DLL creates it, and BUG (not having its own DLL) cannot affect it.
 
The hover text on the F4 relations should still show that info; not as convenient, I know, but it should be there.

How does the game decide what hover text to show, anyhow? Is it the widget type?
 
Back
Top Bottom