Python problem during merge

ripple01

Emperor
Joined
Mar 7, 2006
Messages
1,254
Location
New York City
Hi,

I'm attempting to merge Revolutions into my mod CivFusion. I ripped out all of the Python and am starting over. I merged BUG 2.20 first and then merged Revolutions. Everything seems to work OK so far for the most part; I get the popup at the beginning and the components seem to work OK. I am getting a Python exception while using AIAutoPlay that comes up; I've attached a screenshot. I can click through it but I'd like to nail it down if possible.

Also, I have removed two civilizations and added some civs of my own. I am getting a "can't find type enum for type tag" error. Where can I remove the entries for these two civs and add entries for my own civs?

Thanks very much for any assistance anyone can provide.

Cheers,
ripple01
 

Attachments

  • Civ4ScreenShot0000.JPG
    Civ4ScreenShot0000.JPG
    240.2 KB · Views: 120
I'm afraid I can't help much with the Python error, it's from Civ4lerts which is part of BUG (which I've heard has some bugs ... and that wasn't just for the pun). There's a chance it's caused by an interface between the two, if you PM the code for the function which is causing the bug I can probably help you figure out what's going on.

As for the XML civ def, the two files you might need to change are RebelTypes.py and RevDefs.py. Should be fairly evident what to do.

Hope that helps, look forward to seeing how the Fusion turns out!
 
Hi jdog5000,

I realized after I posted that the error was most likely due to BUG. I'm going to ask over in their forums and see if anyone else has ran into this issue. If that fails, I'll PM you; thanks much for the offer and for pointing me the way to the proper Python files.

Cheers,
ripple01
 
Hi jdog5000,

I've ran into another Python error while merging in 1.3.

Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 18, in ?
File "CvCustomEventManager", line 90, in __init__
File "RevolutionInit", line 59, in __init__
File "CvCustomEventManager", line 124, in addEventHandler
AttributeError
:
'function' object has no attribute 'append'

Failed to load python module CvEventInterface.


Don't know if this is caused by something else I'm merging or not, but wanted to bring it to your attention. Let me know if you need me to post any of the files.

Cheers,
ripple01
 
Hi jdog5000,

I've ran into another Python error while merging in 1.3.

Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 18, in ?
File "CvCustomEventManager", line 90, in __init__
File "RevolutionInit", line 59, in __init__
File "CvCustomEventManager", line 124, in addEventHandler
AttributeError
:
'function' object has no attribute 'append'

Failed to load python module CvEventInterface.


Don't know if this is caused by something else I'm merging or not, but wanted to bring it to your attention. Let me know if you need me to post any of the files.

Cheers,
ripple01

Our line numbers are different, but the only use of "append" in the CustomEventManager is:

Code:
self.EventHandlerMap[eventType].append(eventHandler)

If this is what's on line 124 of your file, it means that somewhere in your code EventHandlerMap[eventType] has been set equal to a function and not a list of functions. In the __init__ function each eventType is given a handler using setEventHandler which contains:

Code:
self.EventHandlerMap[eventType] = [eventHandler]

The eventHandler is in [], meaning it's a single item list. My mod then adds additional handlers using addEventHandler, which appends the Revolution handler to this list of functions which handle this particular event type. The other mods you're using should do something similar, sharing the events with other event handlers instead of instead of reassigning the handler using:

Code:
self.EventHandlerMap[eventType] = eventHandler

Which must be happening somewhere in your code. Since this isn't a list but a function, when my mod tries to append a handler to the 'kbdEvent' handler list it fails.
 
Do a search in your files for "EventHandlerMap" to find all the places it's used and look for ones which don't have the eventHandler in []. Don't worry about popupHandlers ... you only want one handler for those (a popupHandler is what interprets actions after you click buttons in say the RevWatch popup. Instead of names like "kbdHandler" they use numbers and for my mod all the popup numbers are defined in RevDefs.py)

My guess is that the other mod also has a "___EventManger" file and that it's in there somewhere. I'd also guess you merged the contents of such a file into the CustomEventManager already and maybe kept the other functions?

That's the most likely scenario. If it's not the case, well all the event managers inherit from the base event manager (CvEventManager.py from the BTS asset files), so it would be possible that what one does to the EventHandlerMap could effect the others ... not sure about that, but it's possible depending on how Python is implemented.

I don't know what your comfort level with Python modding is, but my suggestion would be to adapt the other mod to use the CustomEventManager from Revolution ... the list of event handlers feature allows you to add more components to the mod easily in the future.
 
Back
Top Bottom