Closed bollbas closed 7 years ago
I've made changes and left the same function for all 4 files but I still can't reuse it from one file to all these 4 files. I've added it to civ6common.lua
then tried to Initialize
it in these files and use it's value. But it didn't work. Can you explain how to do so? Fixed function is in commit above
I can try to. If you look at the top in cqui_settingselement.lua
you will see this row include("Civ6Common")
this means that you can use functions from this file in the current one (might not be totally correct I'm not that good at Lua), like PopulateCheckBox and so on.
So try and add a function to Civ6Common and then call it from another file that have it included to start with. If you want to add a completely new file then it needs to be added in the modinfo file.
Did it clear it up somewhat?
Civ6Common
is already included to city panel
, overview
, citybanner
and reportscreen
files. I tried to add a function to Civ6Common
and simply call it from these files but it didn't work.
Did you try it with return value instead of global variable? The included file can't access the global variable from the calling file.
Do you get any errors in the logs/firetuner when trying this?
The last attached file uses local variable:
local CQUI_HousingFromImprovements = CQUI_RealHousingFromImprovements(selectedCity);
@SpaceOgre it works now. The problem was I forgot to rename a variable in one row. Thanks! :+1:
Something wrong with citybannermanager code changes. It works when start a game, on next turn, when load a saved game but when loading autosaves all citybanners miss.
Can't help you anymore but point out that logs and firetuner are your friends in these situations. My computer with Civ on it is unplugged because of renovation and will be for a couple of days.
Sounds like a missing initialisation... Could be, that there is a different behaviour between "load game" and "continious game".
Yes, it seems so because after disabling/enabling smartbanner settings it works again
I remember something similar within another functionality... Update: Take a look here: #489
Yeah it might be that the citybanner is initialized before some of the things needed for the new functions and thus it crashes. As long as you can figure out what is causing the crash you should hopefully be able to create a check for it so init on load can run and after that is done it should work as intended.
Could be tricky to track down the offending party though.
248 resolved finally! :smile: