I've read through several of the threads here, and I didn't find an answer. Hopefully that's not because my question's too simple, but here goes anyway.
I'm attempting to override onCityBuilt to add some extraneous things, but I'm running into calling convention problems.
My mod initialization looks like this:
Code:
<mod id="Texas" module="Texas">
<option id="Enabled" type="boolean" default="True"/>
<event type="cityAcquired" function="onCityAcquired"/>
<event type="cityBuilt" function="onCityBuilt"/>
</mod>
The log files say the event lines seem to be loading properly:
Code:
18:18:13 DEBUG: BugConfig - loading mod file Texas
18:18:13 DEBUG: BugInit - loading mod Texas...
18:18:13 INFO : BugCore - creating uninitialized mod Texas
18:18:13 DEBUG: BugOptions - added option <Texas__Enabled boolean [True]>
18:18:13 DEBUG: BugUtil - looking up Texas.onCityAcquired
load_module Texas
18:18:13 DEBUG: BugUtil - looking up Texas.onCityBuilt
18:18:13 DEBUG: Timer - load mod [Texas] took 3 ms
When the event actually occurs, though, I get this error:
Code:
18:19:21 TRACE: Error in cityBuilt event handler <function onCityBuilt at 0x189F4EF0>
18:19:21 TRACE: onCityBuilt() takes exactly 2 arguments (1 given)
Looking in the base event handler routine, I see this:
Code:
def onCityBuilt(self, argsList):
...which is what I assumed the calling convention was, and I duplicated it in my custom python routine.
I'm assuming the 'self' part isn't being passed, and indeed the examples in the wiki only pass argsList. If I'm not passed a 'self', how do I handle the call to the city naming function at the bottom of onCityBuilt that gets invoked after I'm done?
Code:
self.__eventEditCityNameBegin(city, False)