Python Trouble...

It looks like you copied my code before I fixed it. Note the "Edit" above. Reverse the parameters to the ininstance() call in the first line you inserted:

Code:
if isinstance([B]key, unicode[/B]):
 
Great, I got almost everything working. In game, all the python loads, but I have a strange error, when I click on the top UI, I get

Traceback (most recent call last):

File "CvScreensInterface", line 931, in handleInput

File "CvMainInterface", line 7973, in handleInput

AttributeError: 'module' object has no attribute 'showBugOptionsScreen'
ERR: Python function handleInput failed, module CvScreensInterface

EDIT:
I'm thinking this has to do with the investment widget. Where is the code that sets where the widgets are and what part of the gamefonts they read from?
 
Widgets don't usually have anything to do with gamefonts; can you explain further what you've added? Is this a button? A clickable text label?

All click-handling should be in handleInput(). It looks like you've added a button to open the BUG Option Screen, yes? What do line 7973 and the surrounding few lines look like?
 
Widgets don't usually have anything to do with gamefonts; can you explain further what you've added? Is this a button? A clickable text label?

All click-handling should be in handleInput(). It looks like you've added a button to open the BUG Option Screen, yes? What do line 7973 and the surrounding few lines look like?

Yeah, it's a new button, see the Dynamic City Devolpment mod's screenshots for better info, but it adds a new button on the left half of the UI. See that's the funny part, I never edited that section. It's:


Code:
# < BUG Button Start >
        if ( inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON and inputClass.getFunctionName() == "BUGButton"):
            self.showBugOptionsScreen()
        elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON and inputClass.getFunctionName() == "BUGButton"):
            self.hideBugOptionsScreen()
            
        if(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName() == "BUGButton"):
            CvScreensInterface.showBugOptionsScreen()
# < BUG Button Mod End >
 
That code isn't from BUG. It must be added by that mod or whatever it's based on (RevDCM?).
 
That code isn't from BUG. It must be added by that mod or whatever it's based on (RevDCM?).

Must be either Jdog5000 or Zappara's change then... Anyways, it runs fine normally, but something I've added must be conflicting with it....
 
It's trying to call CvScreensInterface.showBugOptionsScreen(). Did you replace the CvScreensInterface from the mod with your own?
 
It's trying to call CvScreensInterface.showBugOptionsScreen(). Did you replace the CvScreensInterface from the mod with your own?

Nope. I didn't touch it. However, I searched it for showBugOptionsScreen, and it didn't find any functions with that name...
 
CvMainInterface only tries to call it when you click on something named "BUGButton". Did you perhaps add a new widget using that name?
 
CvMainInterface only tries to call it when you click on something named "BUGButton". Did you perhaps add a new widget using that name?

I don't think so. I added a new button in the city screen...

I just checked a vanilla, unmodded working copy of RoM 2.8, and it has the same section of code in it too.
 
I just checked a vanilla, unmodded working copy of RoM 2.8, and it has the same section of code in it too.

Does it have CvScreensInterface.openBugOptionsScreen()?
 
Does it have CvScreensInterface.openBugOptionsScreen()?

I think I know what's going on. RoM 2.8 beta is an exe, not a rar archive, and when I downloaded at the computer I was on, I pulled the flash drive out too fast, and a small part of the file didn't finish copying over, so I'm missing some other stuff, too. I just need to redownload it, and try with the fresh copy. Rar's will tell you if files are missing, exe's can be set to install even if corrupted. I'll report back when I have more success/failure.
 
I redownloaded vanilla RoM 2.8, and that fixed some issues, but everytime I start a game (an unmodded version, mind you) I get
BugInit CvScreenInterface failed to load

The error is pretty obscure too, I'm not sure what's wrong:

Traceback (most recent call last):
File "BugInit", line 98, in callInits
File "CvScreensInterface", line 1188, in init
File "CvScreensInterface", line 159, in createMilitaryAdvisor
File "CvBUGMilitaryAdvisor", line 82, in __init__
File "UnitGrouper", line 292, in __init__
File "UnitGrouper", line 109, in __init__
File "UnitGrouper", line 88, in __init__
File "BugUtil", line 141, in getPlainText
File "BugUtil", line 153, in getText
ArgumentError: Python argument types in
CyTranslator.getText(CyTranslator, unicode, tuple)
did not match C++ signature:
getText(class CyTranslator {lvalue}, char const *, class boost::python::tuple {lvalue})
 
I don't think so. I added a new button in the city screen...

I just checked a vanilla, unmodded working copy of RoM 2.8, and it has the same section of code in it too.
BUGButton code segments in RoM's MainInterface python are from RevDCM. I think it was Johny Smith who suggested adding such button to maininterface (he was telling about Civ 4 themes as well and what could be done with them to improve interface) and glider had merged those changes to RevDCM. I haven't got that button to work in RoM (does it work in RevDCM, I don't know) but after rechecking and rechecking I haven't been able to locate any missing python code blocks associated with that button from the merge operation. Anyway it could be nice to have a new button to access BUG options instead of the shortcut.
 
Anyway it could be nice to have a new button to access BUG options instead of the shortcut.

Believe me, I'd love to have buttons for a lot of BUG shortcuts. The main issue is that a) theme buttons look much cooler but b) theme buttons require modifying the core BTS themes when installed to CustomAssets. :(

Dealing with themes is a PITA since BUG needs to support both CustomAssets and Mods installation.

Also, it seems RoM has a unit that is missing its <TEXT> description because UnitGrouper is getting a Unicode text key. See post #19 for a Python solution in BugUtil that I've put into BUG.
 
Top Bottom