[MOD] Plot List Enhancement

12monkeys said:
During my tests the INI file was ready out correctly. But in a former 2.x version I put the INi file into the wrong directory and maybe you got that wrong version. The INI file has to be put into the MyGamey\Civilzation 4 directory. Maybe this is the reason that it doesn't work for you.

Regarding pOldPlot I once noticed that problems as well. I put it on my list, but when I planned to start to fix it, I was not able to reproduce it. I will put it on my list again. Unfortunatly I'm currently heavy loaded so that I can't do it quickly. Sorry for this.

12m

Thanks--I think the INI was in the wrong spot; I'll try repositioning it. I'll follow your thread on the pOldPlot issue; if I can come up with a fix I'll let you know.

Just to help--what is the pOldPlot tracking? Why is it needed?
 
Sevo said:
Thanks--I think the INI was in the wrong spot; I'll try repositioning it. I'll follow your thread on the pOldPlot issue; if I can come up with a fix I'll let you know.

Just to help--what is the pOldPlot tracking? Why is it needed?

It used to detect a plot change. On a plot change I have to reinit the sorting and grouping.

12m
 
when testing some code for realism mod, i found small bug in info pane:
if unit got movement type promotion (ie navigation1 for naval or mobility for land unit), max moves info is incorrect : unit has 6 moves navigation1 gives 1 movement = 7, bu info pane show 8 movement (7 as baseMoves and +1 as extraMoves) . bug is in this line:
Code:
fMaxMoves = float(pUnit.baseMoves() + pUnit.getExtraMoves() + pUnit.getExtraMoveDiscount())
because method baseMoves() always return moves with all extra bonuses (as you can found in SDK code:
Code:
int CvUnit::baseMoves() const
{
	return (GC.getUnitInfo(getUnitType()).getMoves() + getExtraMoves() + GET_TEAM(getTeam()).getExtraMoves(getDomainType()));
}
ExtraMoveDiscount is not movement bonus, but change to movement cost...

so for correct info line need to be changed to:
Code:
fMaxMoves = float(pUnit.baseMoves())

after this, all is worked fine (as tested in my game)
anyway this one of the most programed and documented mod ....
 
Mexico said:
when testing some code for realism mod, i found small bug in info pane:
if unit got movement type promotion (ie navigation1 for naval or mobility for land unit), max moves info is incorrect : unit has 6 moves navigation1 gives 1 movement = 7, bu info pane show 8 movement (7 as baseMoves and +1 as extraMoves) . bug is in this line:
Code:
fMaxMoves = float(pUnit.baseMoves() + pUnit.getExtraMoves() + pUnit.getExtraMoveDiscount())
because method baseMoves() always return moves with all extra bonuses (as you can found in SDK code:
Code:
int CvUnit::baseMoves() const
{
	return (GC.getUnitInfo(getUnitType()).getMoves() + getExtraMoves() + GET_TEAM(getTeam()).getExtraMoves(getDomainType()));
}
ExtraMoveDiscount is not movement bonus, but change to movement cost...

so for correct info line need to be changed to:
Code:
fMaxMoves = float(pUnit.baseMoves())

after this, all is worked fine (as tested in my game)
anyway this one of the most programed and documented mod ....

Thx man! Also, for reporting this bug. I plan to rework some parts of the PLE but right now I'm a bit loaded.
I wish I had the SDK during programming PLE, because a lot of things were guesses and try and error. Having the SDK to check what some functions really do, is a big big help nowadays.

12m
 
12monkeys said:
Thx man! Also, for reporting this bug. I plan to rework some parts of the PLE but right now I'm a bit loaded.
I wish I had the SDK during programming PLE, because a lot of things were guesses and try and error. Having the SDK to check what some functions really do, is a big big help nowadays.

12m

ah, i know what you mean. when I first time tried to write something for civ, always i was stopped on lack of documentation. but after releasing SDK it is much more better (still it is time consuming to find what this python method do in game , but it is better then nothing ;-))
 
12monkeys said:
It does not work on all objects. In example the action buttons doen't through that event (in fact they do, but not in the Main Interface). Also it will not work for unit buttons unless you use the widget type WidgetTypes.WIDGET_GENERAL. But be aware, that if you change the widget type of the unit button, you may encounter other sideeffects.

12m

Do you by any chance know how to create a button that is checked for cursor movement? I tried MultiListButtons, ImageButtons, CheckBoxes and so forth, but to no avail. All objects I created had WIDGET_GENERAL as WidgetType. I also tried some other functions I found in the MainInterface.py, for example setHitTest(STRING szName, HitTestType hitTest), but I couldn't find anything that enabled NOTIFY_CURSOR_MOVE_ON and NOTIFY_CURSOR_MOVE_OFF for the button I created.
 
Teg_Navanis said:
Do you by any chance know how to create a button that is checked for cursor movement? I tried MultiListButtons, ImageButtons, CheckBoxes and so forth, but to no avail. All objects I created had WIDGET_GENERAL as WidgetType. I also tried some other functions I found in the MainInterface.py, for example setHitTest(STRING szName, HitTestType hitTest), but I couldn't find anything that enabled NOTIFY_CURSOR_MOVE_ON and NOTIFY_CURSOR_MOVE_OFF for the button I created.

All I can say is, that it worked for me with the WIDGET_GENERAL. You can have a look in the PLE code. You may also look in the code if the Modified Special Domestic Advisor, which also contains mouse over events.

It is also important WHERE you place the button. They be placed in a local context otherwise you don't get an event. EG : if you place them in the action button contaner of the main interface you will never get an event, because this containe is not part of the main interface.

12m
 
Mexico said:
ah, i know what you mean. when I first time tried to write something for civ, always i was stopped on lack of documentation. but after releasing SDK it is much more better (still it is time consuming to find what this python method do in game , but it is better then nothing ;-))

It's a bit time consuming going throught the C++ as well!

Still, considering how it's virtually unheard of for a game developer to, in effect, release the source to the game within 6 months of releasing the game, we have to give credit to Firaxis where it's due...

but a little more documentation would be great. I really miss Locutus's Python API site--it made life much easier.
 
@TGA: Yes, but I try to avoid changes that decrease 'mergeability', namely changes for which I have to edit a large number of files other mods could also use/modify.

@12monkeys: Thanks for the tip concerning your modified domestig advisor - it helped my rule out some possible error sources. After a long series of trial and error, I stumbled over a slight difference that caused my code not to work.

Here is the working code

Code:
		screen.setImageButton("Test1", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_QUESTIONMARK").getPath(), 200, 200, 30, 30, WidgetTypes.WIDGET_GENERAL, -1, -1 )

And here the original one that didn't work

Code:
		screen.setImageButton("Test", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_QUESTIONMARK").getPath(), 200, 200, 30, 30, WidgetTypes.WIDGET_GENERAL, -1, -1 )

The problem is not that I already used the name "Test" elsewhere, but that, apparently, the name has to end with a number in order to be checked for mouse movements.

I have no idea why this is so and I hope this is really as stupid a rule as I think it is and not something which is so logical that you thought it was self-explanatory ;)
 
Teg_Navanis said:
@TGA: Yes, but I try to avoid changes that decrease 'mergeability', namely changes for which I have to edit a large number of files other mods could also use/modify.

@12monkeys: Thanks for the tip concerning your modified domestig advisor - it helped my rule out some possible error sources. After a long series of trial and error, I stumbled over a slight difference that caused my code not to work.

Here is the working code

Code:
		screen.setImageButton("Test1", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_QUESTIONMARK").getPath(), 200, 200, 30, 30, WidgetTypes.WIDGET_GENERAL, -1, -1 )

And here the original one that didn't work

Code:
		screen.setImageButton("Test", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_QUESTIONMARK").getPath(), 200, 200, 30, 30, WidgetTypes.WIDGET_GENERAL, -1, -1 )

The problem is not that I already used the name "Test" elsewhere, but that, apparently, the name has to end with a number in order to be checked for mouse movements.

I have no idea why this is so and I hope this is really as stupid a rule as I think it is and not something which is so logical that you thought it was self-explanatory ;)


Ahhh! Yes, there may be a reason for this. The number at the end is the ID you can check to identify the button. If there is no number, the engine couldn't generate any ID and it may not generate the event.

Just as a guess.

12m
 
Yeah, the id corresponds to the number at the end of the namestring. This is probably also why numbers don't work well with handleinput and why TheLopez used two functions (NumbertoAlpha and AlphatoNumber) to encode/decode any numbers he wanted to be passed through handleinput.
 
12m: I think I finally fixed that interface crash that occurs when you play a game, quit to the main menu, then start a new game without restarting civ. Maybe you addressed this but I didn't see any documentation in the thread and I've been plagued with this thing. Anyway, after I had some time to go through and figure out what was what, turns out it's as easy as adding:

self.pOldPlot = 0

directly under the

def interfaceScreen(self):
...
blah blah blah
...


I stuck it in your first edited block there just for convenience, right above

self.xResolution = screen.getXResolution()
self.yResolution = screen.getYResolution()


and everything seems to work well, now. Just wanted to share.
 
Sevo said:
12m: I think I finally fixed that interface crash that occurs when you play a game, quit to the main menu, then start a new game without restarting civ. Maybe you addressed this but I didn't see any documentation in the thread and I've been plagued with this thing. Anyway, after I had some time to go through and figure out what was what, turns out it's as easy as adding:

self.pOldPlot = 0

directly under the

def interfaceScreen(self):
...
blah blah blah
...


I stuck it in your first edited block there just for convenience, right above

self.xResolution = screen.getXResolution()
self.yResolution = screen.getYResolution()


and everything seems to work well, now. Just wanted to share.

thank ;)
and maybe this help you:
somewhere here was mentioned bug when too much unit was together in stack and wss unaccessible - problem is (i know, this can sound strange) in method which counting move bar
you must replace line, where fMaxMoves is counted:
Code:
fMaxMoves = float(pLoopUnit.baseMoves() + pLoopUnit.getExtraMoves() + pLoopUnit.getExtraMoveDiscount())
in displayUnitPlotListObjects, line 1127 in original PLEMainInterface.py
with:
Code:
fMaxMoves = float(pLoopUnit.baseMoves())

and maybe
Code:
fMaxMoves = float(pUnit.baseMoves() + pUnit.getExtraMoves() + pUnit.getExtraMoveDiscount())
in showUnitInfoPane, line 1609
this solve problem with wrong move info in unit info pane

because method baseMoves() always get moves with all
bonuses (sometimes this lead to floating error exception, but always this lead to unit display problem)

i also found problem, which generate exception when python modules is reloaded (cnged python modules when game is running) - this module uses self.xResolution (self.yResolutions) variables, but this variables is not initialized when module start - so you can add
Code:
self.xResolution=0
self.yResolution=0
into __init__ method (value can be anything, because before each use, this variables is properly set to actual resolution. when i tried to set this variables in __init__ with CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE ).getXResolution(), i've got c++ exception)
 
Sevo said:
12m: I think I finally fixed that interface crash that occurs when you play a game, quit to the main menu, then start a new game without restarting civ. Maybe you addressed this but I didn't see any documentation in the thread and I've been plagued with this thing. Anyway, after I had some time to go through and figure out what was what, turns out it's as easy as adding:

self.pOldPlot = 0

directly under the

def interfaceScreen(self):
...
blah blah blah
...


I stuck it in your first edited block there just for convenience, right above

self.xResolution = screen.getXResolution()
self.yResolution = screen.getYResolution()


and everything seems to work well, now. Just wanted to share.
Ah, very nice. I just started to notice this bug. We're talking about making this modification in PLEMainInterface.py, correct?

There's another small graphical problem involving mouseover of the plot. Sometimes the info pane that comes up doesn't leave once you stop mousingover units. You have to go back and mouse over something else to get it to disappear. Any ideas? It happens almost constantly to me.
 
@_alphabeta_ : the problem may be solved by some new features which are part of the 1.61 update. There are also some other new features which make the PLE more easy and stabile (I hope). I will try to make a new realease the next days/weeks.

@all : Thank you all for reporting and solving those bugs. I'll try to implement the solutions into the a new version as soon as possible.

I will post a todo list for the new version the next days, so you may comment and add whishes and ideas to it.

12m
 
I thought I had posted this before but I cannot find a copy of it now. Anyway, I had mentioned the issue with the sort by production. Frankcor provided this solution ...

frankcor said:
As a workaround for the production sorting issue, I've discovered that by selecting another tab at the bottom of the domestic advisor (great people, example) and then switching back to the City tab results in the sorting beinging what one would expect -- lowest to highest or vice versa.

I tried it and it does work.
 
ruff_hi said:
I thought I had posted this before but I cannot find a copy of it now. Anyway, I had mentioned the issue with the sort by production. Frankcor provided this solution ...



I tried it and it does work.


You couldn't find it here, because its the wrong thread. We're talking about PLE and not about MSDA :D
Anyway, the comments to that solution can you find in the MSDA thread.

12m
 
Back
Top Bottom