UI modifications (suggestions and discussion)

I am still having problems with pain but it seems to finally be on the mend but it still makes concentration difficult. I have made the changes I think I need to make but I am getting this error
Code:
ArgumentError: Python argument types in
    CyGInterfaceScreen.addMultilineText(CyGInterfaceScreen, str, unicode, int, float, int, float, CvPythonExtensions.WidgetTypes, int, int, int)
did not match C++ signature:
    addMultilineText(class CyGInterfaceScreen {lvalue}, char const *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >, int, int, int, int, enum WidgetTypes, int, int, int)

I can't see what is wrong where. The code I use for creating the first variable is almost the same as one which works but slightly faster and uses less memory.
In the one that works
Code:
    def __init__(self):

        self.HELP_AREA_NAME = "CivicsScreenHelpArea"
    
    def drawHelpText(self, iCivicOption):

        szHelpAreaID = self.HELP_AREA_NAME + str(iCivicOption)       
        screen.addMultilineText(szHelpAreaID, szHelpText, fX+5, fY, self.HEADINGS_WIDTH-7, self.HELP_BOTTOM - fY-2, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
In the one that doesn't
Code:
    def drawHelpText(self, iCivicOption):
    
        szPanelIDHelpItem = "CivicStrategyText" + str(iCivicOption)
        screen.addMultilineText(szPanelIDHelpItem, szHelpText, fX+5, fY, self.HEADINGS_WIDTH-7, self.HELP_BOTTOM - fY-2, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
and yet the error is saying the first is class CyGInterfaceScreen {lvalue} and the second is CyGInterfaceScreen.

I had hoped that typing all that in here would have made it clear what I was doing wrong but I still can't see it :(
 
looks to me that your fY is a float when it should be an integer.
Try doing int( fY ) before putting it into the addMultiLineText.
Will continue to analyze your last post, and tell if I see anything else.
 
I see stuff like this:
class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,
and I just say... nope... that's out of my zone. Unless I can see a clear example of something that works being plugged in for that variable.

Interesting that it's called 'unicode' on the python side. I'd be curious to see what 'fX+5' is defined as.

But that doesn't seem to be the issue.
The difference is you have:
szPanelIDHelpItem = "CivicStrategyText" + str(iCivicOption)
And the working example has:
szHelpAreaID = self.HELP_AREA_NAME + str(iCivicOption)
Looking deeper at the working example, you're dealing with a string and I'm not sure if the string is a variable representing a string or a string itself and what it links to and if the new definition is as valid as it may seem to be. Again, this is not a realm I've worked with before myself.
 
fX+5 is an integer

szHelpText is the unicode
(CyGInterfaceScreen, str, unicode,
(class CyGInterfaceScreen {lvalue}, char const *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,
(szPanelIDHelpItem, szHelpText, fX+5

?
 
I believe that "class CyGInterfaceScreen {lvalue}" is skipped; it's a python thing. The green argument is the .self argument and in python that argument is given in front of the function as seen below. The first argument defined in python functions is by design "self".

The code that does work only use 10 arguments, this is true for the version that didn't work too.
screen.addMultilineText(szPanelIDHelpItem, szHelpText, fX+5, fY, self.HEADINGS_WIDTH-7, self.HELP_BOTTOM - fY-2, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
  • screen is an object of the class CyGInterfaceScreen.
  • addMultilineText is a function defined within the class CyGInterfaceScreen.
Edit: I know how to interpret it and code with it, but I'm not sure I'm using the correct terms in explaining it; the curse of being .self thought. ^^

What the debugger says was used by python:
CyGInterfaceScreen.addMultilineText(CyGInterfaceScreen, str, unicode, int, float, int, float, CvPythonExtensions.WidgetTypes, int, int, int)
11 arguments.

What C++ expected:
addMultilineText(class CyGInterfaceScreen {lvalue}, char const *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >, int, int, int, int, enum WidgetTypes, int, int, int)
11 Arguments
 
Last edited:
I think that "class CyGInterfaceScreen {lvalue}" is skipped; it's a python thing.

The code that does work only use 10 arguments, this is true for the version that didn't work too.

What the debugger says was used by python:
CyGInterfaceScreen.addMultilineText(CyGInterfaceScreen, str, unicode, int, float, int, float, CvPythonExtensions.WidgetTypes, int, int, int)
11 arguments.

What C++ expected:
addMultilineText(class CyGInterfaceScreen {lvalue}, char const *, class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >, int, int, int, int, enum WidgetTypes, int, int, int)
11 Arguments

There are 11 arguments because it is screen.addMultilineText() and that means the class is screen. At least that is how it works elsewhere. I'll make sure I have screen defines correctly or at least in the same way.
 
I have been wondering if we could put a maximise button on that part of the screen and when pressed bring up a much larger screen which we can do all this on. You know
- show all the filters better
- show many more than two lines of icons
- have a special don't show these buildings in this city ever again
- have cultures and heroes appear right at the top rather than in the units and wonders section​
1 Like = 1 Pray for qol feature
 
Is it possible to add keybinds for the new Build Up buttons? I use them quite frequently (specifically the Automate Build Up) but I'd like to have a keybind so I can reconfigure one of my mouse's extra buttons to activate it - as I currently have for Fortify - for those lazy game days when playing with just the mouse.
 
Is it possible to add keybinds for the new Build Up buttons? I use them quite frequently (specifically the Automate Build Up) but I'd like to have a keybind so I can reconfigure one of my mouse's extra buttons to activate it - as I currently have for Fortify - for those lazy game days when playing with just the mouse.
Probably. I have no idea how to go about that though. (You're talking about hotkeys right?) I think there might be something in the xml on missions... You might be able to setup a hotkey combo for opening up the buildup menu for a unit (starting the mission) and then there may somehow be a way to setup hotkeys for each option, but again... no idea how to go about all that. This second step is not something done in the code anywhere as it is now so I'd have no example to learn from.
 
Fertility Festival??

it says a variety of things its going to add, but it only has 1 item listed? and that isnt much for a Wonder?? pic 1

Barbs? see pic, words there?? pic 2/
 

Attachments

  • Fertility.JPG
    Fertility.JPG
    252.8 KB · Views: 174
  • barbs.JPG
    barbs.JPG
    308.8 KB · Views: 179
Barbs? see pic, words there?? pic 2/
Yeah, something doesn't seem right about that does it? I'm not sure what the issue is to be honest. I'll have to take a look into it. I know that there is an odd method for determining how big a stack feels like it should be before it's ready to roll out and it can lead to a wide variety of results on that, but I've seen Neanders and Barbs both exhibit this problem where they just build and build and it doesn't seem like they ever do anything with the stack. There's a few possibilities as to what could be going on but again, I'll have to look at it in the code and I may need your save to do it right.
 
I changed Fertility Festival to give a free building, one of the ones usually built by an entertainer. Not sure why it is not showing up in the pedia, it did when I tested it. Maybe I missed something when updating the SVN. One other possibility may be the requirements for that building, I will need to be check it when I get back. I updated my main machine to v37 but copied an old version to my lap top.
 
OK, I have tracked back the Civics screen all the way back to the original conversion to the format used in C2C and other mods. Original by Johny Smith and a variation by our own StrategyOnly. Unfortunately both have the same problem as we have currently, it does not link to the pedia like the BtS Civics screen. I will work forward from StrategyOnly's version once I confirm my guess at a solution works.
 
OK, I have tracked back the Civics screen all the way back to the original conversion to the format used in C2C and other mods. Original by Johny Smith and a variation by our own StrategyOnly. Unfortunately both have the same problem as we have currently, it does not link to the pedia like the BtS Civics screen. I will work forward from StrategyOnly's version once I confirm my guess at a solution works.
Thanks for your continued efforts on this!
 
Is it possible to separate buildable and unbuildable buildings/units?
This way you could have clean list of units/buildings that you can make and separate list of units/buildings, that you can't create.
For example it would be: Building A, B, C - buildable, and then separately: building D - requires other building, Building E - requires that resource and terrain in city vicinity and so on.
Now its can be messy with buildings that you can build mixed with ones that you can't build.
 
Is it possible to separate buildable and unbuildable buildings/units?
This way you could have clean list of units/buildings that you can make and separate list of units/buildings, that you can't create.
For example it would be: Building A, B, C - buildable, and then separately: building D - requires other building, Building E - requires that resource and terrain in city vicinity and so on.
Now its can be messy with buildings that you can build mixed with ones that you can't build.
There's already an option to exclude buildings you can't create. I consider those mix-ins a feature, not a bug.

What does bother me is the fact that the sorting doesn't actually work. Also that the buttons are so small. But trying to view the builds in any order other than hammer cost just gives randomness.
 
What does bother me is the fact that the sorting doesn't actually work. Also that the buttons are so small. But trying to view the builds in any order other than hammer cost just gives randomness.
Really? I'll have to look into that at some point. Maybe if I get comfy working with that I could pull off what Raxo's asking for too. Maybe someday I'll have nothing else to do and will consider this.
 
Yes there is a button to hide/show unbuildable units/buildings.

Yes the sort order is off. Partly because the costing in :hammers: or whatever is based on "actual costs" which are not based on the city and its current buildings etc which may reduce the cost but the "actual cost" without any city bonuses. I.E it is the base cost as appears in the pedia. It is probably done that way for speed but I note that Platyping's fully python version does seem to work well for the normal BtS yields, costs and commerces.

Note remember you can only have three groupings in that area the units, buildings and wonders split and you can't control where it goes back to when you select something to build. That is all done in the exe as is the three small buttons for units, buildings and wonders.
 
Back
Top Bottom