Dale
Mohawk Games Developer
- Joined
- Mar 14, 2002
- Messages
- 7,846
With the ability to add our own advisors via python, it is easy to see how the UI will become very cluttered in the advisor bar. With the space to only add a couple of new advisor buttons, or move into the ilogical menu buttons (menu, pedia, etc) the matter of UI clutter becomes an issue.
If we were to add the current new advisors such as Jeckels Trade Route advisor, Melinko's Finance Advisor, Dom Pedro II's Triangle Trade Advisor, and Melinko's Tech Advisor, we would overflow the advisor area on screen by two icons.
This mod addresses that issue and resolves it cleanly, easily and logically.
The Advisor Menu is a new segment of the UI dedicated to advisor buttons. One simple button (left-hand button where domestic advisor used to be) is used to turn the Advisor Menu on or off. This allows for the retention of a clean UI and the ability to access all of a mod's advisors fast and easily in one area on the screen.
This is a very simple ModComp to implement (only affecting one python file, plus the single new text key) and simple to add new advisors to. Once you have your advisor working, simply add your advisor in two locations and presto, all the rest is taken care of.
Location 1: Define the button in the menu
Location 2: Show/hide the button
The attached screenshots show the menu on and off showing the simple ease of use this ModComp brings. I have also attached the ModComp.
I hope this is useful.
If we were to add the current new advisors such as Jeckels Trade Route advisor, Melinko's Finance Advisor, Dom Pedro II's Triangle Trade Advisor, and Melinko's Tech Advisor, we would overflow the advisor area on screen by two icons.
This mod addresses that issue and resolves it cleanly, easily and logically.

The Advisor Menu is a new segment of the UI dedicated to advisor buttons. One simple button (left-hand button where domestic advisor used to be) is used to turn the Advisor Menu on or off. This allows for the retention of a clean UI and the ability to access all of a mod's advisors fast and easily in one area on the screen.
This is a very simple ModComp to implement (only affecting one python file, plus the single new text key) and simple to add new advisors to. Once you have your advisor working, simply add your advisor in two locations and presto, all the rest is taken care of.

Location 1: Define the button in the menu
Code:
# Advisor menu START
if (ADVISOR_MENU_PANEL_UP):
iBtnX = (xResolution / 2) + (TOP_CENTER_HUD_WIDTH / 2) - (self.ADVISOR_BUTTON_SIZE / 3)
iBtnY = ((TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) / 2) + self.ADVISOR_BUTTON_SIZE
screen.setImageButton("DomesticAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_DOMESTIC_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_DOMESTIC_SCREEN).getActionInfoIndex(), -1 )
screen.setImageShape("DomesticAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
screen.setHitMargins("DomesticAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
self.appendtoHideState(screen, "DomesticAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
iBtnX += self.ADVISOR_BUTTON_SPACING
screen.setImageButton("RevolutionAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_REVOLUTION_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_REVOLUTION_SCREEN).getActionInfoIndex(), -1 )
screen.setImageShape("RevolutionAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
screen.setHitMargins("RevolutionAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
self.appendtoHideState(screen, "RevolutionAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
iBtnX += self.ADVISOR_BUTTON_SPACING
screen.setImageButton("ForeignAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_FOREIGN_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_FOREIGN_SCREEN).getActionInfoIndex(), -1 )
screen.setImageShape("ForeignAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
screen.setHitMargins("ForeignAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
self.appendtoHideState(screen, "ForeignAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
iBtnX += self.ADVISOR_BUTTON_SPACING
screen.setImageButton("MilitaryAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_MILITARY_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_MILITARY_SCREEN).getActionInfoIndex(), -1 )
screen.setImageShape("MilitaryAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
screen.setHitMargins("MilitaryAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
self.appendtoHideState(screen, "MilitaryAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
iBtnX += self.ADVISOR_BUTTON_SPACING
# Advisor menu END
Location 2: Show/hide the button
Code:
# Advisor menu START
elif (inputClass.getButtonType() == WidgetTypes.WIDGET_GENERAL and inputClass.getData1() == ADVISOR_MENU_PANEL):
screen = CyGInterfaceScreen("MainInterface", CvScreenEnums.MAIN_INTERFACE )
if (ADVISOR_MENU_PANEL_UP):
ADVISOR_MENU_PANEL_UP = False
screen.hide("DomesticAdvisorButton")
screen.hide("RevolutionAdvisorButton")
screen.hide("ForeignAdvisorButton")
screen.hide("MilitaryAdvisorButton")
else:
ADVISOR_MENU_PANEL_UP = True
screen.show("DomesticAdvisorButton")
screen.show("RevolutionAdvisorButton")
screen.show("ForeignAdvisorButton")
screen.show("MilitaryAdvisorButton")
# Advisor menu END
The attached screenshots show the menu on and off showing the simple ease of use this ModComp brings. I have also attached the ModComp.
I hope this is useful.
