member66170
King
- Joined
- Oct 30, 2005
- Messages
- 807
.
Last edited:
Lord Olleus said:Is there a way of changing what the on the screen text says depending on what is happening in the game. For example would it be possible to change TXT_KEY_MISSION_PILLAGE_HELP so that it tells you the name of the improvement that you are going to pillage?
<Tag>INTERFACE_PANE_UNIT_NAME</Tag>
<English>[COLOR_UNIT_TEXT]%s1[COLOR_REVERT]</English>
<French>[COLOR_UNIT_TEXT]%s1[COLOR_REVERT]</French>
<German>[COLOR_UNIT_TEXT]%s1[COLOR_REVERT]</German>
<Italian>[COLOR_UNIT_TEXT]%s1[COLOR_REVERT]</Italian>
<Spanish>[COLOR_UNIT_TEXT]%s1[COLOR_REVERT]</Spanish>
</Tag>
szBuffer = localText.getText("INTERFACE_PANE_UNIT_NAME", ([b]pHeadSelectedUnit.getName(), [/b]))
Lord Olleus said:great minds think alike. You wouldn't be interested in joining the Warhammer Mod by any chance? </ShamelessSelfAdvertising>
Lord Olleus said:Just one more question
Do you know which python file controlls the bottom central panel when units are selected? Thats the one where all the different icons for all the missions are displayed. I've looked at the code for hours but can't find it.
Lord Olleus said:Thanks. Unfortunately it doesn't do what I hoped it would. Do you know which file controlls the text that appears when you mouse over the selection buttons?
void CvDLLWidgetData::parseTrainHelp(CvWidgetDataStruct &widgetDataStruct, CvWString &szBuffer)
{
CvCity* pHeadSelectedCity;
UnitTypes eUnit;
if (widgetDataStruct.m_iData2 != FFreeList::INVALID_INDEX)
{
pHeadSelectedCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(widgetDataStruct.m_iData2);
}
else
{
pHeadSelectedCity = gDLL->getInterfaceIFace()->getHeadSelectedCity();
}
if (pHeadSelectedCity != NULL)
{
eUnit = (UnitTypes)GC.getCivilizationInfo(pHeadSelectedCity->getCivilizationType()).getCivilizationUnits(widgetDataStruct.m_iData1);
[b] GAMETEXT.setUnitHelp(szBuffer, eUnit, false, widgetDataStruct.m_bOption, false, pHeadSelectedCity);[/b]
}
}
Caesium said:OK, a question to that theme: In some cases you can't build an improvement, but the button appears grayed out. Is there a possibility not to show these grayed out buttons?
# Units to construct
for i in range ( g_NumUnitClassInfos ):
eLoopUnit = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationUnits(i)
if (pHeadSelectedCity.canTrain(eLoopUnit, False, True)): [b] # Note 1 #[/b]
screen.appendMultiListButton( "BottomButtonContainer", gc.getUnitInfo(eLoopUnit).getButton(), iRow, WidgetTypes.WIDGET_TRAIN, i, -1, False )
screen.show( "BottomButtonContainer" )
if ( not pHeadSelectedCity.canTrain(eLoopUnit, False, False) ): [b]# Note 2 #[/b]
screen.disableMultiListButton( "BottomButtonContainer", iRow, iCount, gc.getUnitInfo(eLoopUnit).getButton() )
iCount = iCount + 1
bFound = True
iCount = 0
if (bFound):
iRow = iRow + 1
bFound = False
# Units to construct
for i in range ( g_NumUnitClassInfos ):
eLoopUnit = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationUnits(i)
if (pHeadSelectedCity.canTrain(eLoopUnit, False, [b]False[/b])): # Note 1 #
screen.appendMultiListButton( "BottomButtonContainer", gc.getUnitInfo(eLoopUnit).getButton(), iRow, WidgetTypes.WIDGET_TRAIN, i, -1, False )
screen.show( "BottomButtonContainer" )
[s]if ( not pHeadSelectedCity.canTrain(eLoopUnit, False, False) ): [/s]
[s]screen.disableMultiListButton( "BottomButtonContainer", iRow, iCount, gc.getUnitInfo(eLoopUnit).getButton() )[/s]
iCount = iCount + 1
bFound = True
iCount = 0
if (bFound):
iRow = iRow + 1
bFound = False
I don't have problems with units, only with the improvement build options of workers etc.Gerikes said:For example, check out where they place the unit buttons in CvMainInterface.py, under the function updateSelectionFunction()...
Code:# Units to construct for i in range ( g_NumUnitClassInfos ): eLoopUnit = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationUnits(i) if (pHeadSelectedCity.canTrain(eLoopUnit, False, True)): [b] # Note 1 #[/b] screen.appendMultiListButton( "BottomButtonContainer", gc.getUnitInfo(eLoopUnit).getButton(), iRow, WidgetTypes.WIDGET_TRAIN, i, -1, False ) screen.show( "BottomButtonContainer" ) if ( not pHeadSelectedCity.canTrain(eLoopUnit, False, False) ): [b]# Note 2 #[/b] screen.disableMultiListButton( "BottomButtonContainer", iRow, iCount, gc.getUnitInfo(eLoopUnit).getButton() ) iCount = iCount + 1 bFound = True iCount = 0 if (bFound): iRow = iRow + 1 bFound = False
The first use of canTrain (note 1) uses the bVisible argument as True, meaning it's just checking visibility (can the person see this unit train icon?) The second time (note that the third argument is now false at Note 2) checks if the player can train this unit. If not, then this button should be greyed out.
To change this, you would probably want to call just one version of canTrain, using the bVisible flag as false before creating the button. Something like...
Code:# Units to construct for i in range ( g_NumUnitClassInfos ): eLoopUnit = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationUnits(i) if (pHeadSelectedCity.canTrain(eLoopUnit, False, [b]False[/b])): # Note 1 # screen.appendMultiListButton( "BottomButtonContainer", gc.getUnitInfo(eLoopUnit).getButton(), iRow, WidgetTypes.WIDGET_TRAIN, i, -1, False ) screen.show( "BottomButtonContainer" ) [s]if ( not pHeadSelectedCity.canTrain(eLoopUnit, False, False) ): [/s] [s]screen.disableMultiListButton( "BottomButtonContainer", iRow, iCount, gc.getUnitInfo(eLoopUnit).getButton() )[/s] iCount = iCount + 1 bFound = True iCount = 0 if (bFound): iRow = iRow + 1 bFound = False
Edit: I didn't test any of that code, but hopefully that helps you get started.
Caesium said:I don't have problems with units, only with the improvement build options of workers etc.
self.setMinimapButtonVisibility(True)
if (CyInterface().getInterfaceMode() == InterfaceModeTypes.INTERFACEMODE_SELECTION):
if ( pHeadSelectedUnit.getOwner() == gc.getGame().getActivePlayer() and g_pSelectedUnit != pHeadSelectedUnit ):
g_pSelectedUnit = pHeadSelectedUnit
iCount = 0
actions = CyInterface().getActionsToShow()
for i in actions:
screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )
screen.show( "BottomButtonContainer" )
[b]if ( not CyInterface().canHandleAction(i, False) ):
screen.disableMultiListButton( "BottomButtonContainer", 0, iCount, gc.getActionInfo(i).getButton() )[/b]
if ( pHeadSelectedUnit.isActionRecommended(i) ):#or gc.getActionInfo(i).getCommandType() == CommandTypes.COMMAND_PROMOTION ):
screen.enableMultiListPulse( "BottomButtonContainer", True, 0, iCount )
else:
screen.enableMultiListPulse( "BottomButtonContainer", False, 0, iCount )
iCount = iCount + 1
if (CyInterface().canCreateGroup()):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CREATEGROUP").getPath(), 0, WidgetTypes.WIDGET_CREATE_GROUP, -1, -1, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (CyInterface().canDeleteGroup()):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_SPLITGROUP").getPath(), 0, WidgetTypes.WIDGET_DELETE_GROUP, -1, -1, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
self.setMinimapButtonVisibility(True)
if (CyInterface().getInterfaceMode() == InterfaceModeTypes.INTERFACEMODE_SELECTION):
if ( pHeadSelectedUnit.getOwner() == gc.getGame().getActivePlayer() and g_pSelectedUnit != pHeadSelectedUnit ):
g_pSelectedUnit = pHeadSelectedUnit
iCount = 0
actions = CyInterface().getActionsToShow()
for i in actions:
[s]screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )[/s]
[s]screen.show( "BottomButtonContainer" )[/s]
if ( not CyInterface().canHandleAction(i, False) ):
[s]screen.disableMultiListButton( "BottomButtonContainer", 0, iCount, gc.getActionInfo(i).getButton() )[/s]
[b]screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )[/b]
[b]screen.show( "BottomButtonContainer" )[/b]
[b] # Begin indent
if ( pHeadSelectedUnit.isActionRecommended(i) ):#or gc.getActionInfo(i).getCommandType() == CommandTypes.COMMAND_PROMOTION ):
screen.enableMultiListPulse( "BottomButtonContainer", True, 0, iCount )
else:
screen.enableMultiListPulse( "BottomButtonContainer", False, 0, iCount )
iCount = iCount + 1
# End Indent[/b]
if (CyInterface().canCreateGroup()):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CREATEGROUP").getPath(), 0, WidgetTypes.WIDGET_CREATE_GROUP, -1, -1, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1
if (CyInterface().canDeleteGroup()):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_SPLITGROUP").getPath(), 0, WidgetTypes.WIDGET_DELETE_GROUP, -1, -1, False )
screen.show( "BottomButtonContainer" )
iCount = iCount + 1