Simple Python Things

Hey, The_J, I just tested it and it seems to work in a normal game, however it doesn't seem to work correctly in my scenario. It does work perfectly in another scenario. I can't seem to figure it out why the Civil war event does not happen in the main scenario of my mod "2100". The event is supposed to happen to "Brussel", there is a city on the map exactly named "Brussel" on the map. It is also only supposed to happen to the civ "Europe" and their leader "Her Holiness" which I play on the map.
This is the main info on the scenario:
Spoiler :
Era=ERA_FUTURE
Speed=GAMESPEED_EPIC
Calendar=CALENDAR_SEASONS
Option=GAMEOPTION_NO_BARBARIANS
Option=GAMEOPTION_NO_GOODY_HUTS
Victory=VICTORY_TIME
Victory=VICTORY_CONQUEST
Victory=VICTORY_DOMINATION
Victory=VICTORY_CULTURAL
Victory=VICTORY_SPACE_RACE
Victory=VICTORY_DIPLOMATIC
GameTurn=629
MaxTurns=200
MaxCityElimination=0
NumAdvancedStartPoints=12600
TargetScore=0
StartYear=1943

I ensured minimum 3 unhappiness is needed, Brussels had 7 unhappiness for ten turns, yet nothing happened. Same in normal game, civ immediately spawns after turn 1.
I really don't know how to fix it or what I'm doing wrong, I could post the entire mod, so you could help me or is this info enough? Thanks!
EDIT:However if I rename the original Brussel to another name and rename another city to "Brussel", the civ does spawn and the event does happen
 
There may be a typo or something in the code you added to the files, unless those files are self contained and you just added them to the mod folder, it could be anything like an accidental space or a comma or anything, just one little bit in one piece of the code could stop the whole thing working in your mod.. So you could try adding it in again to see if that works..
 
Quite big, 235 MB.
Also I don't think it's a typo in the code, in a normal game, everything works perfectly.
Also if I rename another city to "Brussel" in the scenario, it does work.
 
Nope, Rome is the capital of the "Great Christian Empire", the United States of Europe are supposed to spawn in Brussel.
 
The_J,

Where in CvMainInterface.py can I adjust the position of this scrollbar?
 

Attachments

  • row.jpg
    row.jpg
    24 KB · Views: 140
No real idea (although I have a suspicion that I have edited around in that part of the interface at some point...where is it...don't know...will have to look it up...).
What exactly do you want to adjust?

mmhh...adjusting my mod comp to that shouldn't be too hard.
I hope I can find some time on Sunday for that.

:blush: I'm terribly sorry, but holiday planing has stolen the majority of my weekend.
I don't think I'll be able to do it within the next 2 weeks.
I'm sorry :blush:.
 
No real idea (although I have a suspicion that I have edited around in that part of the interface at some point...where is it...don't know...will have to look it up...).
What exactly do you want to adjust?
I would like to take the scroll bar more to the right.
 
I would like to take the scroll bar more to the right.

If you could get ahold of AIAndy, he is really really good with any CvMainInterface.py problems, but he has been missing in action for 2 weeks now:dunno:
 
The scrollbar should be part of the list itself, so making the list itself wider should move it to the right. It's just a question of figuring out which control is the right one...

It is probably a "table" type thing with one column added via something like "screen.addTableControlGFC" which has the width as the 5th parameter.

I am assuming that is the city build list in the lower left corner of the screen. If so, then that is the "InfoPane" and the place to do the adjusting would be in updateInfoPaneStrings, at the line that says this, or something like it:
Code:
		screen.addTableControlGFC( "SelectedCityText", 3, 10, yResolution - 139, 183, 128, False, False, 32, 32, TableStyles.TABLE_STYLE_STANDARD )
The value 183 is the width of the table.
 
If you could get ahold of AIAndy, he is really really good with any CvMainInterface.py problems, but he has been missing in action for 2 weeks now:dunno:
I hope he appears, he is a great help to the civ-community.

The scrollbar should be part of the list itself, so making the list itself wider should move it to the right. It's just a question of figuring out which control is the right one...

It is probably a "table" type thing with one column added via something like "screen.addTableControlGFC" which has the width as the 5th parameter.

I am assuming that is the city build list in the lower left corner of the screen. If so, then that is the "InfoPane" and the place to do the adjusting would be in updateInfoPaneStrings, at the line that says this, or something like it:
Code:
		screen.addTableControlGFC( "SelectedCityText", 3, 10, yResolution - 139, 183, 128, False, False, 32, 32, TableStyles.TABLE_STYLE_STANDARD )
The value 183 is the width of the table.

Thank you very much, it took me 5 hours to find this value, before seeing your post ... basically, I changed ALL the values ​​of "screen.addTableControlGFC" found in CvMainInterface.py to find ... there to after line 4000, found
 
this would be what is it
Code:
bIsProcess = city.isProductionProcess()
iPastOverflow = if bIsProcess 0 else city.getOverflowProduction()

the second line is the python equivalent of the ternary statement you see in the C++ code, hope that helps!!!

the two statements are similar just C++ uses punctuation to show the ternary:

? stands for if, so

bIsProcess?

can really be read as a question.

the next part is your two options, success : failure

for the python it is:

if condition success else failure

in C++

condition? success : failure

an alternate (but bulkier) version of this would be do do this
Code:
bIsProcess = city.isProductionProcess()
if bIsProcess:
    iPastOverflow = 0
else:
    iPastOverflow = city.getOverflowProduction()
 
an alternate (but bulkier) version of this would be do do this
Code:
bIsProcess = city.isProductionProcess()
if bIsProcess = city.isProductionProcess():
    iPastOverflow = 0
else:
    iPastOverflow = city.getOverflowProduction()

The "= city.isProductionProcess()" on the second line shouldn't be there.

A somewhat shorter version would be this:
Code:
iPastOverflow = 0
if not city.isProductionProcess():
    iPastOverflow = city.getOverflowProduction()
If you are not going to use the "bIsProcess" variable for anything else, you may as well get rid of it like that. If it is going to be checked again then you may want to keep it.
 
Back
Top Bottom