OK, I've tested this some more, and I can't get it to create a settler if no city exists. My code, roughly, is:
(Obviously this is provisional code as this will only work once, for the first city built, but even that didn't work. Note that of course when I call your function at iX, iY it hands control over to the resurrected civ and I die...)
Code:
def onCityBuilt(self, argsList) :
city = argsList[0]
iX = city.getX()
iY = city.getY()
iXX = iX-4
iYY = iY-4
oPlot = CyMap().plot(iXX, iYY)
if oPlot.getPlotType() == 2:
CvUtil.pyPrint("Land -- Good")
if (city.getOwner() == CyGame().getActivePlayer()):
success = game.createNewPlayer(1, 1, 1, iXX, iYY )
if( not success ) :
CvUtil.pyPrint(" BC - FAILED to create civ at X %d, Y %d"%(iXX,iYY))
return
CvUtil.pyPrint('City Built Event: %s' %(city.getName()))