Dancing Hoskuld
Deity
Hi, as the title says I am converting some of Tsentom1's python wonders into BUG format. Some I have had no problems with. Others are proving I have gaps in my python knowledge and one is defying reason - so I think it is a dyslexia problem.
Problem 1. to improve the speed of the python I want to keep a flag indicating that the building has been built and who it was being built by. I thought I was doing globals right but evidently not.
The values are still false and None in the other events in the mod when run. I did look at the initialization section in the modders forum but it is blank.
Do I need to say global gb_GreatBathBuilt somewhere? In each of the event code functions or at the top?
Problem 2. dyslexia.
As far as I can tell I have done the Trafalgar Square code in the same way I have done all the others. But I get the error saying that the onBuildingBuilt and ocCombatResult functions are not defined. Python and Config XML files attached. I have been loking at it for a couple of days on and off o I need a fresh pair of eyes to look at it.
Thanks.
Problem 1. to improve the speed of the python I want to keep a flag indicating that the building has been built and who it was being built by. I thought I was doing globals right but evidently not.
Code:
# globals
gi_GreatBath = gc.getInfoTypeForString( 'BUILDING_GREAT_BATH')
gi_RainWaterBasin = gc.getInfoTypeForString( "FEATURE_RAINWATER_BASIN")
gb_GreatBathBuilt = false
gb_GreatBathBuiltBy = None
###################################################
def onBuildingBuilt(argsList):
'Building Completed'
pCity, iBuildingType = argsList
game = gc.getGame()
## Great Bath Start ##
if iBuildingType == gi_GreatBath:
BugUtil.debug("Great Bath built (onBuildingBuilt called).")
gb_GreatBathBuilt = true
pPlayer = gc.getPlayer(pCity.plot().getOwner())
gb_GreatBathBuiltBy = pPlayer
The values are still false and None in the other events in the mod when run. I did look at the initialization section in the modders forum but it is blank.
Do I need to say global gb_GreatBathBuilt somewhere? In each of the event code functions or at the top?
Problem 2. dyslexia.
As far as I can tell I have done the Trafalgar Square code in the same way I have done all the others. But I get the error saying that the onBuildingBuilt and ocCombatResult functions are not defined. Python and Config XML files attached. I have been loking at it for a couple of days on and off o I need a fresh pair of eyes to look at it.
Thanks.