help, please II.

hrochland

Prince
Joined
Apr 9, 2006
Messages
2,511
Location
Czech Kingdom
Hi, all. I want use this code for swamp draining but it is wrong. Can you see error here, please.
Thank for help

PHP:
	def onImprovementBuilt(self, argsList):
		'Improvement Built'
		iImprovement, iX, iY = argsList
###Draining###
		pPlot = CyMap().plot(iX, iY)
		if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_CREATE_GRASS'):
				pPlot.setTerrainType(gc.getInfoTypeForString( "TERRAIN_GRASS" ), 1, 1)
		    pPlot.setImprovementType(-1)
###Draining###

		if (not self.__LOG_IMPROVEMENT):
			return
 
Well, the first thing is that your indentation levels are apparently different for the two lines after the "if" line. They should be at the same indentation level.

Second, what is wrong with it? Be more specific. Does it do nothing? Does it do some of what you expect but not all of it? Does it do something entirely unexpected? Does it make your computer throw itself out the nearest window?
 
Yes. I have opened window two days already and nothink :)
This code is my solution for swamp draining. I try remade PioneertankMod (The_J) for change terrain from swamp to grassland.
- action name/Draining
- tool/IMPROVEMENT_CREATE_GRASS
- code/square with IMPROVEMENT_CREATE_GRASS replace by terrain_grass

indentation is same as in original and original works...
I´m not coder. I tried rework The_J´s code only...

some idea?
 
Yeah, enable Python exceptions and pop-ups in the main INI file.
 
Back
Top Bottom