Requests for new components (and features)

I'd like the name to reflect the leader I am playing so that if I'm playing Augustus, it says

Augustus/Rome
Yes it does make sense. Let me fire up my little program again - modding your civ4 installation - done. Now, go into your game, hit escape, click on 'your details' and edit the top box with what ever you would like ... 'Egg Sandwich'? And you are all set.

Spoiler :
as it, its already in the game
 
Don't mind Ruff; someone peed in his Corn Flakes this morning. :p

I've added the feature to the scoreboard and committed it to SVN.
 
I am loving the way you add options to the new core. :goodjob: As a testdrive, I decided to implement 2 additions to the scoreboard power ratio on my local copy. The first was adding the ability to reverse the meaning of the ratio as I previously requested earlier in the topic.

Spoiler Quote of the original request :
On my copy of BUG, I have reversed the meaning of the scoreboard power ratio from the default "us/them" where high numbers are better for you to "them/us" where low numbers are better for you. That method just makes more sense to me and makes AI-AI power comparisons easier for me. I would like to see support for this as a general option although a couple changes would need to be made. I can think of several ways to do it but the simplest from a code point of view is the following:

  1. Add an options screen checkbox for "Reverse Power Ratio" on the Scoreboard tab.
  2. Rename the current options for "Good Ratio Color" and "Good Cutoff" to "High Ratio Color" and "High Cutoff."
  3. Rename the current options for "Bad Ratio Color" and "Bad Cutoff" to "Low Ratio Color" and "Low Cutoff."
  4. When the reverse option is checked you could add something like the following after the current fPowerRatio calculation:
    Code:
    if (bReverseRatio):
    	if (fPowerRatio != 0):
    		fPowerRatio = 1/fPowerRatio
    	else:
    		fPowerRatio = 99.9
    The rest of the code can basically stay the same as the comparisons still make sense if you interpret good as high and bad as low.
Advantages to this method are minimal code change and the contents of the cutoff menu options remain the same; only the labels for the options screen actually have to change. From a user standpoint, you just turn on the reverse option, tweak the cutoffs to your liking, and then switch the colors so that high is red and low is green (or whatever your prefs).

Disadvantages are that because the labels do change the options screen might be a little more confusing, especially when first experimenting with the reverse option. Perhaps some help or hover text could be worked in to remind that in the default situation high means good and in the reverse situation high means bad.

Also reading the Python might be a little confusing since "Good" in the variable and function names would really mean "High" and could actually be Bad when using the reverse ratio option.
The second was allowing a choice in the precision (i.e. number of decimals) for the power ratio display. If you want to include them in the stock BUG, here are the changes made:

Config/Advanced Scoreboard.xml:
Added new option and list tags for these options; note that while the Power Reversed option has a default of "False", it actually seemed to default to True the first time I fired up the game after making this change.
Code:
			<option id="PowerReversed" key="Power Reversed" 
					type="boolean" default="False" 
					get="isPowerReversed" set="setPowerReversed" dirtyBit="Score"/>
			<list   id="PowerDecimals" key="Power Ratio Decimals" 
					type="int" default="1" values="1, 2, 3, 4" 
					get="getPowerDecimals" set="setPowerDecimals" dirtyBit="Score"/>

Python/BUG/Tabs/BugScoreOptionsTab.py
Added the new checkbox and dropdown list.
Code:
		self.addCheckbox(screen, center, "Scores__PowerReversed")
		self.addIntDropdown(screen, center, center, "Scores__PowerDecimals", True)

Python/Screens/CvMainInterface.py
Implementation; the precision function uses the preexisting BugUtil.formatFloat() function because it was there. The reversal function has slightly different divide by zero avoidance than the normal ratio; this should probably have been handled a little differently, but I was looking to make minimal changes and so took this route.
Code:
													fPowerRatio = float(iPlayerPower) / float(iPower)
													if (ScoreOpt.isPowerReversed()):
														if (fPowerRatio > 0):
															fPowerRatio = 1.0 / fPowerRatio
														else:
															fPowerRatio = 99.0
													cPower = gc.getGame().getSymbolID(FontSymbols.STRENGTH_CHAR)
													szTempBuffer = BugUtil.formatFloat(fPowerRatio, ScoreOpt.getPowerDecimals()) + u"%c" % (cPower)

XML/Text/BUGOptions_CIV4GameText.xml
This actually has the most changes and so it's not quoted. New label and hover text for the two new options were added. However, in order to support the reversed ratio in a minimally-confusing manner, everything previously called "Good" Ratio/Color was renamed to "High" and everything previously called "Bad" Ratio/Color was renamed to "Low." These will all need to be retranslated so I slapped the new english in for all the languages even though only a word or two would probably need to be changed. If this does go into BUG as-is, the translators would then need to refer to the previous version to get the old wording.

Attached to the post is a RAR file with the 4 changed files (based on rev 1226). Below are images showing the changes in action.

New options shown but not used (intended defaults):
1219989363.jpg


New options shown and used (Note colors changed too):
1219989444.jpg


EDIT: Attachment removed as EF merged a slightly altered version into SVN.
 
I am loving the way you add options to the new core. :goodjob:

I'm glad you like it. The main reason for doing it this way, beyond XML being more approachable than Python for modders, is that you can specify just what you want for your options and omit the rest much more easily than you could with the Python constructors.

I still need to create a DTD and schema for people using XMLSpy and similar tools and for validating the XML (though the Python XML parser embedded in Civ4 doesn't do validation :().

In any case, I've added your feature to BUG. I altered it slightly: instead of a checkbox it's a dropdown: "You vs. Them" or "Them vs. You". This way you don't have to explain what the normal formula is in order for someone to know what the reversed version will be. :)

I also changed Good to High and Bad to Low in the code to match the text. This seemed pretty low risk, but if anyone has any trouble with the scoreboard, it's probably my recklessness. :mischief:
 
Translated the specialist's text in city view and the military advisor's territory description.

Just replace the files, it's based on svn 1229.
And add this text to one of your xyz_CIV4GameText files:

Code:
	<TEXT>
		<Tag>TXT_KEY_BUG_MOD_SPECIALISTS</Tag>
		<English>Specialists</English>
		<French>Spécialistes</French>
		<German>Spezialisten</German>
		<Italian>Specialists</Italian>
		<Spanish>Specialists</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_DOMESTIC_CITY</Tag>
		<English>Domestic City</English>
		<French>Domestic City</French>
		<German>Eigene Stadt</German>
		<Italian>Domestic City</Italian>
		<Spanish>Domestic City</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_DOMESTIC_TERRITORY</Tag>
		<English>Domestic Territory</English>
		<French>Domestic Territory</French>
		<German>Eigenes Territorium</German>
		<Italian>Domestic Territory</Italian>
		<Spanish>Domestic Territory</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_TEAM_CITY</Tag>
		<English>Team City</English>
		<French>Team City</French>
		<German>Team Stadt</German>
		<Italian>Team City</Italian>
		<Spanish>Team City</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_TEAM_TERRITORY</Tag>
		<English>Team Territory</English>
		<French>Team Territory</French>
		<German>Team Territorium</German>
		<Italian>Team Territory</Italian>
		<Spanish>Team Territory</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_FRIENDLY_CITY</Tag>
		<English>Friendly City</English>
		<French>Friendly City</French>
		<German>Befreundete Stadt</German>
		<Italian>Friendly City</Italian>
		<Spanish>Friendly City</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_FRIENDLY_TERRITORY</Tag>
		<English>Friendly Territory</English>
		<French>Friendly Territory</French>
		<German>Befreundetes Territorium</German>
		<Italian>Friendly Territory</Italian>
		<Spanish>Friendly Territory</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_NEUTRAL_TERRITORY</Tag>
		<English>Neutral Territory</English>
		<French>Neutral Territory</French>
		<German>Neutrales Territorium</German>
		<Italian>Neutral Territory</Italian>
		<Spanish>Neutral Territory</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_ENEMY_TERRITORY</Tag>
		<English>Enemy Territory</English>
		<French>Enemy Territory</French>
		<German>Feindterritorium</German>
		<Italian>Enemy Territory</Italian>
		<Spanish>Enemy Territory</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_MILITARY_ADVISOR_BARBARIAN_TERRITORY</Tag>
		<English>Barbarian Territory</English>
		<French>Barbarian Territory</French>
		<German>Barbarenterritorium</German>
		<Italian>Barbarian Territory</Italian>
		<Spanish>Barbarian Territory</Spanish>
	</TEXT>
 

Attachments

Translated the specialist's text in city view and the military advisor's territory description.

I fixed the Main Interface (actually used the existing label translation TXT_KEY_CONCEPT_SPECIALISTS.

I've added your Location Group translations (plus all the others) for UnitGrouper. Thanks.
 
And another three translations (apollo for german issues).

Code:
	<TEXT>
		<Tag>TXT_KEY_BUG_PROJECT_APOLLO_PROGRAM</Tag>
		<English>Apollo Program</English>
		<French>Programme Apollo</French>
		<German>Apollo-Programm</German>
		<Italian>Programma Apollo</Italian>
		<Spanish>el Programa Apollo</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_SEVOPEDIA_HISTORY</Tag>
		<English>History</English>
		<French>History</French>
		<German>Geschichtliche Hintergründe</German>
		<Italian>History</Italian>
		<Spanish>History</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_VICTORY_RELIGIOUS_NO_HOLY_CITY</Tag>
		<English>No Holy City</English>
		<French>Pas de Ville Sainte</French>
		<German>Keine heilige Stadt</German>
		<Italian>No Holy City</Italian>
		<Spanish>No Holy City</Spanish>
	</TEXT>

And two translations added, that were already in Civ4 python but don't have text keys:
Code:
	<TEXT>
		<Tag>TXT_KEY_CIV_MINOR_PEDIA</Tag>
		<English>No description provided.</English>
		<French>Description non fournie.</French>
		<German>Keine Informationen verfügbar.</German>
		<Italian>Nessuna descrizione fornita.</Italian>
		<Spanish>Ninguna descripciòn proporcionada.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_LEADER_BARBARIAN_PEDIA</Tag>
		<English>No description provided.</English>
		<French>Description non fournie.</French>
		<German>Keine Informationen verfügbar.</German>
		<Italian>Nessuna descrizione fornita.</Italian>
		<Spanish>Ninguna descripciòn proporcionada.</Spanish>
	</TEXT>
 

Attachments

Some of these new XML keys you're adding already exist in a usable form in the Civ4 XML files. I tend to do a quick search for

<English>History</English>​

for example to see if I can reuse an existing tag.
 
yes - but the german version that caesium has contains different stuff ... all the gender stuff.
 
yes - but the german version that caesium has contains different stuff ... all the gender stuff.

I'm not talking about the Victory Screen or Apollo Program tags. I've left those to you since you know that screen already.
 
EF's advanced ordering and filtering options

I have added dropdown listboxes to handle the first part: selecting the two grouping methods for units. I have also fixed the bug where some units aren't displayed. I'll probably clean it up visually and commit what I have next week (I'm out of town this weekend), but I'll hold off on the filtering until later.

I think we have some much more interesting features to add before filtering units in the MA. However, filtering can be implemented using the grouping feature already.

For example, a filter to weed out healthy units could be done as a Health group with two groupings: healthy and wounded. Bingo, all done. :)
 
Feature Request: Adding Espionage movement/cost info to the PLE unit hover.

Currently, the enhanced PLE-mouseover info for spy units does not include the espionage cost modifier/movement notification. This makes conducting large-scale espionage inefficient because you have to individually select each spy unit and then hover over the unit close-up info in the lower left corner of the screen to see it. I would like this info added to the mouseover info for the plot icons too.

This is somewhat confusing to explain because I don't know the right terminology, so some pictures:

Current Behavior:

1) Mousing over the individual unit icons:
1220237022.jpg


2) Mousing over the lower-left area with unit(s) selected:
1220237040.jpg


Proposed Change:
1) Mousing over a stationary spy:
1220237909.jpg


2) Mousing over a moved spy:
1220238413.jpg


To implement the change, the following two additions need to be made to CvMainInterface.py. First, a new block to create the new text. This is pretty closely copied from the SDK function which adds the same info to the standard unit hover, with necessary Python concessions such as working-around the lack of a CyUnit.isSpy() function. For my test, I added it between the current fortify bonus and unit type specialty sections.
Code:
		# espionage info; mimic of CvGameTextMgr::setEspionageMissionHelp()
		szEspionage = u""
		if gc.getUnitInfo(pUnit.getUnitType()).isSpy():
			pPlot = pUnit.plot()
			eOwner = pPlot.getOwner()
			pOwner = gc.getPlayer(eOwner)
			if pOwner and not pOwner.isNone():
				eOwnerTeam = pOwner.getTeam()
				if eOwnerTeam != pUnit.getTeam():
					if not pUnit.canEspionage(pPlot):
						szEspionage = szEspionage + localText.getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE", ())
						if pUnit.hasMoved() or pUnit.isMadeAttack():
							szEspionage = szEspionage + localText.getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE_REASON_MOVED", ())
						elif not pUnit.isInvisible(eOwnerTeam, False):
							szEspionage = szEspionage + localText.getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE_REASON_VISIBLE", (pOwner.getNameKey(),))
					elif pUnit.getFortifyTurns() > 0:
						iModifier = -(pUnit.getFortifyTurns() * gc.getDefineINT("ESPIONAGE_EACH_TURN_UNIT_COST_DECREASE"))
						if 0 != iModifier:
							szEspionage = szEspionage + localText.getText("TXT_KEY_ESPIONAGE_COST", (iModifier,))
		if szEspionage:
			szEspionage = u"<font=2>" + szEspionage + u"\n" + u"</font>"
Then, that piece of text needs to be added to the large build string:
Code:
		# build text
		szText 	= szUnitName + \
				szPromotion + \
				szStrengthMovement + \
				szLevel + \
				szExperience + \
				szCargo + \
				szCiv + \
				szFortifyBonus + \
				szEspionage + \
				szSpecialText

Attached is a CvMainInterface.py based on current SVN at time of this posting with the changes included.
 

Attachments

It doesn't work for me... how do you get this result? :confused:
Really? Steps:
  • start with vanilla Civ4 (should work with BUG too)
  • Click on the Military Advisor (F5)
  • make sure that you haven't selected any units
  • Click on the '+' beside 'show all units' this will show a page similar to above
  • move your mouse down to 1 particular unit, click on it.
 
Really? Steps:
  • start with vanilla Civ4 (should work with BUG too)
  • Click on the Military Advisor (F5)
  • make sure that you haven't selected any units
  • Click on the '+' beside 'show all units' this will show a page similar to above
  • move your mouse down to 1 particular unit, click on it.

:blush::blush::blush:

I tried it, but instead of clicking on the name of unit, I always clicked on the unit type... that is, in your example "Worker (4)". So now I get it, you can select all the units of the same type (wherever they are) or the single units, but not the groups of units we have created (for example, not all the unit of the same type in the same type of terrain) if not manually by multiple manual selections... is it right? :blush:
Ok, good enough! :)
Oh, and thanks for the help :)
 
Back
Top Bottom