• Civilization 7 has been announced. For more info please check the forum here .

Quick question

Go to the format menu and select "Encode in UTF-8" or possibly "UTF-8 (without BOM)". Then save the module.
 
Still getting a Python Exception, as follows

1st line - Traceback (most recent call last):
2nd line - File "<string>",line 1, in ?
3rd line - File "<string>",line 52, in load_module
4th line - File "CvEventInterface", line 7, in ?
5th line - File "<string>", line 52, in load_module
6th line - File "CvEventManager", line 12, in ?
7th line - File "<string>, line 52, in load_module
8th line - File "CvScreensInterface", line 19, in ?
9th line - File "<string>", line 52, in load_module
11th line - File "CvDanQuayle", line 8, in ?
12th line - File "<string>", line 35, in load_module
13th line - File "<string>", line 13, in _get_code
14th line - File "
15th line - CvGameUtils
16th line - ", line
17th line - 108
18th line -
19th line - eUnitCombat = self.unitCombatDict.get(eUnitType, None):
20th line to 73rd line -
74th line - ^
75th line - SyntaxError
76th line - :
77th line - invalid syntax
78th line -
79th line - Failed to load python module CvEventInterface.

As you can see, it's a totally different message to last time. Any chance you can DL the mod and try out your code yourself and see if you get the same problem?
 
Its the same thing as before - delete the colon at the end of this line:
Code:
eUnitCombat = self.unitCombatDict.get(eUnitType, None)[COLOR="Red"]:[/COLOR]
I thought you already fixed this? :confused:
 
Anyway, this can be used in the original game, right? I understand that, for example, some of the code has to go in CvEvents.py (if that exists even) instead of in CvFinalFrontierEvents.py, but, besides such things, the code is compatible with normal BTS (and, in extension, RevDCM), right?
I missed your post.

The code posted in this thread can also be used in a standard BtS setup, but beware of the syntactical errors that we are clearing up. And the other file (besides CvGameUtils) you need to edit is called CvEventManager by default. The code basically goes into the same places.

RevDCM and other mods might be built around the BUG infrastructure and I can't say for sure that it will work. It would be possible to use the BUG methodology for enabling the same code. (There is a BUG modding tutorial for this.)
 
OK, here we are again, i have ensured that the pesky colon is not there before posting, still getting the Python load fail. This is the message i'm getting.

1st line - Traceback (most recent call last):
2nd line - File "<string>", line 1, in ?
3rd line - File "<string>", line 52, in load_module
4th line - File "CvEventInterface", line 8, in ?
5th line - File "<string>", line 35, in load_module
6th line - File "<string>", line 13, in _get_code
7th line - File "
8th line - CvFinalFrontierEvents
9th line - ", line
10th line - 36
11th line -
12th line -
13th line - from CvGameUtils import CvGameUtils
14th line -
15th line -
16th line -
17th line -
18th line - ^
19th line - IndentationError
20th line - :
21st line - expected an indented block
22nd line -
23rd line - Failed to load python module CvEventInterface.

"Encode in UTF-8" or possibly "UTF-8 (without BOM)"
I can encode in either of these, which should i use? Currently using UTF-8 (without BOM)

EDIT: just changed the encoding from without BOM to just UTF-8 and got two additional messages when trying to load the mod. Screen shots below.
 
I believe I always use UTF-8 - because I don't use Notepad++ and my editor doesn't have the "without BOM" thingy.
 
Still getting the same error message, the last 2, the ones on the screen shots, looking at the files they mention and comparing them to the original files from Final Frontier show the files are the same and so i shouldn't be getting any error messages. Having resaved the files and encoding them as UTF-8 has removed the last 2 problems but the Python error persists. At least i know which encoding works now.
 
Ok, this is my fault for supplying you with code I never tested myself. It shouldn't be hard at all to sort this out and there is no reason for you to do the debugging. Just give me a download link to where I can get the mod, and also attach the files you edited as a result of this discussion, and I'll sort it out for you.

edit: This is what I think: The .py files should use BOM and the .xml files shouldn't. So select "without BOM" for the XML only. If this fails, then I can have a look at the whole mess.
 
I missed your post.

The code posted in this thread can also be used in a standard BtS setup, but beware of the syntactical errors that we are clearing up. And the other file (besides CvGameUtils) you need to edit is called CvEventManager by default. The code basically goes into the same places.

RevDCM and other mods might be built around the BUG infrastructure and I can't say for sure that it will work. It would be possible to use the BUG methodology for enabling the same code. (There is a BUG modding tutorial for this.)

I'll try it out sometime and let you know.
 
Ok, this is my fault for supplying you with code I never tested myself. It shouldn't be hard at all to sort this out and there is no reason for you to do the debugging. Just give me a download link to where I can get the mod, and also attach the files you edited as a result of this discussion, and I'll sort it out for you.
The link for the mod is in my signature (The Babylon Project one).
edit: This is what I think: The .py files should use BOM and the .xml files shouldn't. So select "without BOM" for the XML only. If this fails, then I can have a look at the whole mess.
As it's late and i need some sleep, i'll have a go at this in the morning and post the results.
 
So... How did it go?
 
edit: This is what I think: The .py files should use BOM and the .xml files shouldn't. So select "without BOM" for the XML only. If this fails, then I can have a look at the whole mess.
OK, just to confirm how i'm going to try this out the .py files should be encoded with UTF-8 and the .xml files with UTF-8 without BOM?

Edit: I've just done some investigating and questioning of someone that helped us with the Mod last year. Turns out our Mod does have BUG, So i have been trying to get something to work that won't work because, as you said in a much earlier post, it needs a different approach.

Sorry for wasting so much time in finding this out.

What do we do now?
 
I have almost no experience with the BUG architecture but the basic code remains the same - you simply have to use it differently. Someone should be able to help you out, or you could take a look at the BUG documentation yourself.

I could probably help out with this myself but I can't promise any results within any time-frame. I do know however that you need to make a new Python module holding the code I posted. (The easies option would be to use classes and keep the code intact - because its all instance methods at this point. Its all explained in the BUG tutorial.) Then you enable the code and the callbacks and whatever by editing some BUG xml file. (Perhaps even add your own XML file.)

To me this is more complicated than doing it without BUG, but I realize its only because I've never really use it myself. I did help someone out with a similar project recently and since I'm new at XML editing it didn't go very smoothly. :p This is how I learned about the BOM issue, which I still think is just plain stupid. But working with BUG is still superior - if you learn it you'll be better off than knowing how to do thing without it. And the mod you're working on also uses BUG, so you should probably know this stuff regardless.
 
I'm downloading the mod from the link in your signature now, but the prognosis isn't looking good: ETA 22 hours! :eek2:

You could simply zip up the Python folder and any BUG folder in the mod and post in this thread. That would be sufficient to get a better grasp of how things are set up and what you need to do. Because we should be able to figure it out. :D
 
Ok, so I installed your mod and can't find anything relating to BUG anywhere. So I guess the guy who worked with the BUG stuff earlier was mistaken. :confused:

I'll see if I can't sort this out in a jiffy.
 
edit: You can probably ignore this post. :p
Spoiler :
I started up a game after doing a quick copy-paste of my code and got this:
Traceback (most recent call last):

File "CvEventInterface", line 19, in onEvent

File "CvEventManager", line 187, in handleEvent

File "CvFinalFrontierEvents", line 167, in onGameStart

File "CvAI", line 120, in doCityAIUpdate

AttributeError: 'NoneType' object has no attribute 'getPopulationLimit'
ERR: Python function onEvent failed, module CvEventInterface
I guess you haven't seen this one before since you probably haven't enabled exception pop-ups, but it caused me to lose the game before it even started. Its basically this line in CvAI.py:
Code:
		iMaxSupportablePop = [B]pSystem[/B].getPopulationLimit(true)
Somehow the pSystem name/variable is pointing to the value None, rather than to something that the getPopulationLimit() method can be invoked on. This means that the mod needs some debugging because this surely never should happen.

You could probably get around the issue with this line, as a quick fix:
Code:
		pSystem = FinalFrontier.getSystemAt(pCity.getX(), pCity.getY())

[B]		if pSystem == None: return[/B]
		
		iOwner = pCity.getOwner()
		
		iMaxSupportablePop = pSystem.getPopulationLimit(true)
This will however disable a presumably vital feature in the inner workings of the mod, so this should never become a permanent solution to this potential problem.

Or wait a minute: I ran a custom game and got a random Civ. Perhaps I'm not supposed to do that? :blush: I'll try again. :p
 
Top Bottom