Platy's Peculiar Pleasant Posh Python

Ultrapack Advisors

Feats:
Simplified codes further

Advisors Pop Ups:
Relevant item lists stored as global upon loading
Example:
If city is unhappy and needs a happy building, it will only loop through all buildings with happiness and find a best one, rather than loop through all buildings.

Similarly, if city needs to expand, it will just loop through units which can settle, rather than all units. Effectively, in BTS, list of units which can settle == just one item.
 
Very neat solution :)
 
Nothing much actually, since nobody activates advisor pop ups anyway.
Irritating advisors...
 
Well, first you create new ones via XML, which should be obvious.

Then I make the option screen display them, since new graphic options are out of GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES which is hard coded. CvOptionsScreen

Lastly, I added simple codes to set them to default XML value each time the mod is loaded, because they are set to random values, since they are out of GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, which is pretty idiotic, so if you change any Platy options in the option screen, they will only last for the session until you exit the mod.
 
Well, first you create new ones via XML, which should be obvious.

Then I make the option screen display them, since new graphic options are out of GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES which is hard coded. CvOptionsScreen

Lastly, I added simple codes to set them to default XML value each time the mod is loaded, because they are set to random values, since they are out of GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, which is pretty idiotic, so if you change any Platy options in the option screen, they will only last for the session until you exit the mod.

I can recreate the XML entries. I can also use C++ to add the new graphic option ( I did that for the GG bar following your example). What I really meant was how did you get the checkboxs to display on the platy tab as opposed to the graphic options tab?
 
Because the option screen will only display up to GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES in the standard Graphic tab.

So I simply define a new Platy tab, and display the new options in that tab instead. The codes are all commented in that file, which is actually quite small.

Thus, if you edit the dll to define new graphic options, thus changing GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, then automatically, these new ones will be included in standard Graphic tab.

Notes:
Standard Graphic tab
for iOptionLoop in xrange(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):

Platy tab
for iOptionLoop in xrange(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES + 4):

Thus, new graphic options which are out of the range of GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, goes to Platy tab
 
Ultrapack

Making advisors more useful...

When Advisors are activated, Tech screen will inform which tech is scientific, cultural etc. This does make the text abit too long and may clash into the prereq techs, if the box is not long enough.

Hints0000_zps85613407.jpg


Domestic Advisors are given a new hint section, which functions more in depth than the naggy advisor pop ups.
It will advise you which building is the best to build based on the city's condition.
Of course, some of the calculations involved are estimates, especially for trade, since some values are not exposed to python.
 
Ultrapack Tech Screen

TechScreen0001_zps01a351f9.jpg


1) Added a Progress Bar and Remove the (Turns Left) Text, to make it shorter...

2) Advisor icons now permanent.

3) Fixed a bug where progress/turns left does not get updated unless you clicked something.
For instance, if turns left for current research is 6, and you exit the screen.
3 turns later, reopening the tech advisor will still display as 6 turns left.
(BTS Bug)
 
How hard would it be to make a tech tree that only displays researchable techs?
 
How hard would it be to make a tech tree that only displays researchable techs?

This techtree already has that option, I believe.

@Platy I was thinking about something, but I don't know python and wanted to know how hard it would be to code. Right now the Great General Bard does nothing when you click on it (My version/BUG). What if when you clicked on it you cycle through any available Great Generals on screen. I always seem to lose track of them. Has it already been done?
 
Press Ctrl F2 to check where your gg led units are.
As for free gg, just check where they are via military advisor?

Edit:
Removed Great People Movie test codes
 
Maybe you can give me some advice. I am trying to put the great person icon into my great person bar, but it doesn't seem to work. I thought all I needed to do is a simple replacement, but id doesn't work:
Code:
szText = (CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR), 0) + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)
instead of:
Code:
szText = "GreatPerson: " + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)

Code:
############################################################
##########=MSM===GP Bar (Impaler)===3/4===0===
############################################################
				if (not CyInterface().isCityScreenUp()):
					if CyUserProfile().getGraphicOption(gc.getInfoTypeForString("GRAPHICOPTION_GREAT_PERSON_BAR")):
						pGreatPersonCity, iGPTurns = self.getnextGPCity()
						if (iGPTurns < 10000000 and pGreatPersonCity):
							[COLOR="Magenta"]szText = "GreatPerson: " + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)[/COLOR]					
							screen.setText( "GreatPersonBarText", "Background", szText, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(565), 31, -0.4, FontTypes.GAME_FONT, WidgetTypes.WIDGET_HELP_GREAT_PEOPLE, -1, -1 )
							screen.show( "GreatPersonBarText" )
							fThreshold = float( gc.getPlayer( pGreatPersonCity.getOwner() ).greatPeopleThreshold(false) )
							fRate = float(pGreatPersonCity.getGreatPeopleRate())
							iFirst = float(pGreatPersonCity.getGreatPeopleProgress()) / fThreshold

							screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_STORED, iFirst )
							if ( iFirst == 1 ):
								screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_RATE, fRate / fThreshold )
							else:
								screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_RATE, fRate / fThreshold / ( 1 - iFirst ) )				
							screen.show( "GreatPersonBar" )					
						else:	
							screen.hide( "GreatPersonBar" )
							screen.hide( "GreatPersonBarText" )
############################################################
##########=MSM===GP Bar (Impaler)===3/4===X===
############################################################
 
Symbol is a char, not a str.
You can't merge them simply like that.
Use Cytranslator().getText("[ICON_GREATPEOPLE]", ())

The alternative if you insist on using char would look like this:
Code:
szText = (%c: %s(%d)) % (CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR), pGreatPersonCity.getName(), iGPTurns)
 
Well, I figured it out by using PAE's version of the bar. One more question. I want to set some hover text. Where exactly is it in your code please?

## Great People Bar ##
Code:
					if CyUserProfile().getGraphicOption(gc.getInfoTypeForString("GRAPHICOPTION_GREAT_PEOPLE_BAR")):
						iMinTurns = 99999
						iCityID = -1
						(loopCity, iter) = pPlayer.firstCity(False)
						while(loopCity):
							iRate = loopCity.getGreatPeopleRate()
							if iRate > 0:
								iTurns = (pPlayer.greatPeopleThreshold(false) - loopCity.getGreatPeopleProgress() + iRate - 1) / iRate
								if iTurns < iMinTurns:
									iMinTurns = iTurns
									iCityID = loopCity.getID()
							(loopCity, iter) = pPlayer.nextCity(iter, False)
						if iCityID > -1:
							pCity = pPlayer.getCity(iCityID)
							screen.addStackedBarGFC( "MainGPBar", xResolution /2 - iBarWidth /2 + 32, 3 + 24, iBarWidth - 36, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_PYTHON, 7200 + ePlayer, iCityID)
							screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_STORED") )
							screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_RATE") )
							screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
							screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )

							fGreatProgress = float(pCity.getGreatPeopleProgress()) / pPlayer.greatPeopleThreshold(false)
							screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_STORED, fGreatProgress)
							screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_RATE, 0.0)
							if fGreatProgress < 1:
								screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_RATE, ( float(pCity.getGreatPeopleRate()) / (pPlayer.greatPeopleThreshold(false) - pCity.getGreatPeopleProgress())))
							
							iGreatUnit = -1
							iMaxProgress = 0
							for i in xrange(len(self.lGreatPeople)):
								iUnitClass = self.lGreatPeople[i]
								iUnit = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationUnits(iUnitClass)
								if iUnit == -1: continue
								iProgress = pCity.getGreatPeopleUnitProgress(iUnit)
								if iProgress > iMaxProgress:
									iMaxProgress = iProgress
									iGreatUnit = iUnit
							screen.addTableControlGFC( "MainGPText", 1, xResolution /2 - iBarWidth /2, 4 + 24, iBarWidth, iStackBarHeight, False, False, 28, 28, TableStyles.TABLE_STYLE_EMPTY )
							screen.setTableColumnHeader( "MainGPText", 0, u"", iBarWidth)
							screen.appendTableRow( "MainGPText" )
							sUnit = ""
							sButton = ""
							if iGreatUnit > -1:
								sUnit = gc.getUnitInfo(iGreatUnit).getDescription()
								sButton = gc.getUnitInfo(iGreatUnit).getButton()
							sText = u"<font=3>%s: %s (%d)</font>" %(pCity.getName(), sUnit, iMinTurns)
							screen.setTableText( "MainGPText", 0, 0, sText, sButton, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY)
							screen.setHitTest( "MainGPText", HitTestTypes.HITTEST_NOHIT )
## Great People Bar ##
 
In the History Rewritten thread you mentioned some fixes/extensions to Kathy's Goody Islands that we might try. Basically loop through the plots to find the generated units and replace them with the best sea unit available. We are doing the first (C2C & HR) but use a hard coded solution.

1) Can you point me to one of your modules that does the bit that finds the best available unit?

2) While the above approach works for the generated barbarians it is not as useful for the player ones since you may have a transport with those units in it also on the plot. Is there a way to tell if the (land) unit is not on board a transport?
 
Back
Top Bottom