Simple Python Things

Thank you all three :).

Just a question - does the believer trait work for captured cities? If not, is it easy to modify so that it does?

D***, forgot that.
To fix it, copy the code over to after
PHP:
	def onCityAcquiredAndKept(self, argsList):
		'City Acquired and Kept'
		iOwner,pCity = argsList

and change the "city" in the believer code to pCity.
If your state religion is already present, you'll get an unneccessary message about that the religion is spread to the city, but that's it.
I'll fix the thing on saturday, or so.



And i'll later this day reupload the invisible dummy techs for sevopedia, because there has been a graphical quirck in combination with BUG.
Edit: Done :).
 
And i'll later this day reupload the invisible dummy techs for sevopedia, because there has been a graphical quirck in combination with BUG.
Edit: Done :).

I just downloaded the new version but I noticed that the code for the function you've modified is different to the code already in place - even outside of your marked changes:

Your changed function:
Code:
	def getSortedList(self, numInfos, getInfo):
		list = [(0,0)] * numInfos
		for i in range(numInfos):
			list[i] = (getInfo(i).getDescription(), i)
                ###invisible dummy tech - sevopedia start
		if getInfo == gc.getTechInfo:
                        for j in range(numInfos-1,-1,-1):
                                if gc.getTechInfo(j).getGridX()<=0 or gc.getTechInfo(j).getGridY()<=0:
                                        list.pop(j)
                ###invisible dummy tech - sevopedia end			
		if self.bSortLists:
			list.sort()
		return list

Unchanged function in BUG 4.3 (Python/Contrib/Sevopedia/SevoPediaMain.py):

Code:
	def getSortedList(self, numInfos, getInfo, noSort=False):
		list = []
		for i in range(numInfos):
			item = getInfo(i)
			if item:
				list.append((item.getDescription(), i))
		if self.isSortLists() and not noSort:
			list.sort()
		return list

So I'm not sure what to do here. Is it just that your comments are in the wrong place?
 
Change SPECIALBUILDING_TEMPLE to SPECIALBUILDING_MONASTERY

:thanx:
EDIT: How do you add another trait i.e. Believer and Extreme Believer?
 
There's a file under XML\Civilizations called Civ4TraitInfos. Copy-paste one of the entries and change the names and numbers. If you then want the python to apply to it, you'll have to copy that changing the references to match.
 
There's a file under XML\Civilizations called Civ4TraitInfos. Copy-paste one of the entries and change the names and numbers. If you then want the python to apply to it, you'll have to copy that changing the references to match.

quick reply ;) :thanx: again!
 
I just downloaded the new version but I noticed that the code for the function you've modified is different to the code already in place - even outside of your marked changes:

Your changed function:
Code:
	def getSortedList(self, numInfos, getInfo):
		list = [(0,0)] * numInfos
		for i in range(numInfos):
			list[i] = (getInfo(i).getDescription(), i)
                ###invisible dummy tech - sevopedia start
		if getInfo == gc.getTechInfo:
                        for j in range(numInfos-1,-1,-1):
                                if gc.getTechInfo(j).getGridX()<=0 or gc.getTechInfo(j).getGridY()<=0:
                                        list.pop(j)
                ###invisible dummy tech - sevopedia end			
		if self.bSortLists:
			list.sort()
		return list

Unchanged function in BUG 4.3 (Python/Contrib/Sevopedia/SevoPediaMain.py):

Code:
	def getSortedList(self, numInfos, getInfo, noSort=False):
		list = []
		for i in range(numInfos):
			item = getInfo(i)
			if item:
				list.append((item.getDescription(), i))
		if self.isSortLists() and not noSort:
			list.sort()
		return list

So I'm not sure what to do here. Is it just that your comments are in the wrong place?

No, sorry, i just didn't really notice, that there's much difference when testing it.
Somebody else has also asked for this.
Just place the code after:
PHP:
	def getSortedList(self, numInfos, getInfo, noSort=False):
		list = []
		for i in range(numInfos):
			item = getInfo(i)
			if item:
				list.append((item.getDescription(), i))



I think, i should add this to the description.

One more thing for SpawnACiv,How do I make the Civ spawn if there is already a City on the Space?

What do you mean?
If there is already a city at the place, the spawning civ will get a city at a random place instead.

The code can also be modified in that way, that this is ignored, so that the old city is destroyed, but i'm not sure, if this causes war, or would maybe even break the game.

If you want to try it, then change in SpawnCityUtil.py the line 99 from
PHP:
                if not pPlot.isCity():

to
PHP:
                if True:



(if somebody else wonders, why i give the advice to create an if clause, which is always true: Yes, removing it would be easier, but a bunch of code would then have to be re-intended, and that's not an easy task if you don't know anything about python)
 
What do you mean?
If there is already a city at the place, the spawning civ will get a city at a random place instead.

The code can also be modified in that way, that this is ignored, so that the old city is destroyed, but i'm not sure, if this causes war, or would maybe even break the game.

If you want to try it, then change in SpawnCityUtil.py the line 99 from
PHP:
                if not pPlot.isCity():

to
PHP:
                if True:



(if somebody else wonders, why i give the advice to create an if clause, which is always true: Yes, removing it would be easier, but a bunch of code would then have to be re-intended, and that's not an easy task if you don't know anything about python)

I am using it to spawn 1 city with X,Y tags so I want the 2nd Option
 
Weird huh?
 

Attachments

  • Babylon-Eridu.JPG
    Babylon-Eridu.JPG
    93.8 KB · Views: 66
  • Eridu-Babylon.JPG
    Eridu-Babylon.JPG
    96.3 KB · Views: 133
I just added your Respawn Promotion to my Fairy Tale, The J. The merge didn't even take five minutes and it makes my hero units all the more worthwhile. Thanks for your fun Python additions, The J. I actually think I saw a couple more interesting ones I could use! :)
 
Weird huh?

:lol:
Okay, so that doesn't work.
I guess only the city has to be extincted before, i'll take a look at it at the weekend.

What does this mean?

Yeah i get this stuff(crap) all the time when a python is incorrect someplace (i think near the top)?

I've never seen this error before :dunno:.
When does it appear?

The error itself seems to come from the saving function, which is really strange :confused:. I haven't modified anything in this file.

I just added your Respawn Promotion to my Fairy Tale, The J. The merge didn't even take five minutes and it makes my hero units all the more worthwhile. Thanks for your fun Python additions, The J. I actually think I saw a couple more interesting ones I could use! :)

Thanks for the compliments :).
 
I've never seen this error before :dunno:.
When does it appear?

The error itself seems to come from the saving function, which is really strange :confused:. I haven't modified anything in this file.

I believe its a WoC/Rev/etc thing, i just cant figued it out. Nothing to do with your stuff directly, i hope. Its just like your Militia, i canNOT get it to work with WoC/Rev etc stuff in a modular format.
The units are listed, they can be placed ingame, but will NOT show up automatically like they are supposed to.
 
Back
Top Bottom