Modifying Custom Domestic Advisor (CDA)

Balderstrom

Emperor
Joined
Oct 25, 2007
Messages
1,141
Location
Halifax, NS, Canada
I've been able to figure out how to make the cDAdvisor resize based on changing 2 Width/Length values, and putting in formulas instead of hard number assignments.
Though haven't quite gotten it to the point where it fetches my actual screen resolution - I see that is possible, but am a little confused with python syntax and how to query that value on "self" or whether I need to create a new "screen" variable and query that.

The one thing I can't quite figure out atm is how to change where the Custom Domestic Advisor starts drawing on screen... I've extended it width-wise to the right; believe I have the values I need to adjust to increase the height - will test that further today.
But I can't seem to get the Window/Table/Panel to start drawing a little further to the left - which leaves a large gap of space there.

Anyone can give me a few pointers, would be much appreciated.
 
Well I've got the CDA set I believe for auto-resizing based on screen resolution, except for the initial assignment of
* self.nScreenWidth = 1680
* self.nScreenLength = 1050

Which I should be able to query my screen resolution instead...?

The only other thing besides that, that I still can't figure out - as I noted above... Is how to have the Panel/Window display further to the left...
Any pointers?

Screenie:
Spoiler :
Civ4ScreenShot0003.JPG
 
Well believe I can figure out the auto-setting of the screen resolution - without hardcoding the values. But from what I can tell for repositioning the CDA itself, the x/y values seem to be starting from 0 already... Unless the assignment of the window itself to "Domestic Advisor" further down has hidden defaults which determine where to position the CDA window.

Most scripting languages that I've dealt with are pretty close to "C" or even one of the old standards "LPC" (used for a large number of muds).

Can upload the file - if theres any interest... The CDA window was just too small for me, as I've upped the in-game Fonts a pt or 2 after applying Blue Marble.
 
You should be able to get screen resolution with ...

CyGInterfaceScreen.getXResolution() - returns int
CyGInterfaceScreen.getYResolution() - returns int

I cannot remember what the CDA screen is - is it a popup or something different. Anyway, look to use the '.setPosition(x,y)' command to set the top left corner. To get the CDA in the middle of the screen, use ...

Code:
Note: not real code!!!
x1 = (screen.x - CDA.x)/2
y1 = (screen.y - CDA.y)/2
CDA.setPosition(x1,y1)
This info was found here ... http://civilization4.net/files/modding/PythonAPI/
 
thx 12m - first post in 18 months I notice and you make it in our little ol' mod ;)
 
Just use the attached PY File. Its based in the actual BUG release.
If its the file from the downloadable BUG - that's what I was working from. I have BUG installed, and the CDA is now resizing properly - aside from a few minor 'quirks' that don't affect usability, like
the close button is ~75% from the bottom left, instead of on/near the bottom right corner.

I just can't get the window repositioned so the top/bottom left corner anchors(window draw points) start further to the left. I'm happy with the overall auto-resize for a wide screen monitor, would just like to center the CDA window.
 
If its the file from the downloadable BUG - that's what I was working from. I have BUG installed, and the CDA is now resizing properly - aside from a few minor 'quirks' that don't affect usability, like
the close button is ~75% from the bottom left, instead of on/near the bottom right corner.

I just can't get the window repositioned so the top/bottom left corner anchors(window draw points) start further to the left. I'm happy with the overall auto-resize for a wide screen monitor, would just like to center the CDA window.

Just check my version how I did it. Every button position is located properly in every resolution. Also in customizing mode, the column width is auto adjusted.

BTW: I center the window "manually" by calculating the margins.
 
I've modified the Custom Domestic Advisor for Wide Screens. If your Resolution is 1024x768, there are no changes. Anything larger than that utilizes 50% of the extra space. I incorporated some of 12Monkeys code, along with what I had done last year.

Heres the original CDA shown w/ Resolution: 1680x1050
Spoiler :
Civ4ScreenShot0005.JPG
Heres the revised CDA
Spoiler :
Civ4ScreenShot0006.JPG
If someone wants to give me a couple pointers for adding Options to the BUG Options screen, and a quick note on how to go about uploading via TortoiseSVN I'll start incorporating some of the stuff that I've tested on my local BUG Copy.

Note: I kept running into Python script errors that I couldn't quite figure out, they only seemed to occur after ALT-Tabbing out from CIV, and back again.
After purging the cache (Local Settings/Application Data/My Games/) - the errors disappeared. Thus far have not been able to replicate any of the script errors since purging the cache.
 
Note: I kept running into Python script errors that I couldn't quite figure out, they only seemed to occur after ALT-Tabbing out from CIV, and back again.
After purging the cache (Local Settings/Application Data/My Games/) - the errors disappeared. Thus far have not been able to replicate any of the script errors since purging the cache.
I get these too - seems to be an issue that is affecting the reloaded python files. I've changed my testing to restarting Civ.
 
This happens when reloading a Python module that defines a class with instance variables. These are variables defined in the __init__() method. When reloaded, existing instances of the class are created, but they lose all their values.

Unfortunately, PLE stores all of its stuff in instance variables, making the main inferface fail to reload. This is something I will address eventually.
 
Back
Top Bottom