Having trouble adding custom options to mapscript

8BitArchitect

Chieftain
Joined
Sep 12, 2013
Messages
57
Hey, I've been trying to modify the Faire Weather mapscript for RaR to add some more custom options. I thought I found every segment that needed to be modified, but when I load the mapscript in 'Custom game', all the custom options are gone.

I've attached my modified mapscript (you'll need to change the extension) to this post. Can anyone help me figure out what I'm missing?


EDIT: Corrected attachment. I have not commented my changes but they should be obvious with something like winmerge.
View attachment CustomWeather.txt
 
Normally Python Exceptions should point you to the errors.

Did you activate them ?

Spoiler :

In CivilizationIV.ini :

; Set to 1 for no python exception popups
HidePythonExceptions = 0
 
I've attached my modified mapscript (you'll need to change the extension) to this post. Can anyone help me figure out what I'm missing?

View attachment 392469
DiffMerge shows me no differences between your attached file and the RaR mapscript.

Did you attach the modified version? And did you mark your changes (by a comment)?
 
... I didn't attach the right file let me edit that in the first post.

EDIT: After enabling python exceptions, it gives me a syntax error when it gets to the line that adds the first new custom option.
 
I opened the script with Python Idle and it told me that line indentations were wrong.
Also in line 433
self.HillChanceAtOne = 0.5 - self.peakpercent + self.hillpercent
should be
self.HillChanceAtOne = 0.5 - self.PeakPercent + self.HillPercent
I think.

After fixing typos and line indents I got the new options (Land, Hill and Peak Percent) to be available and they seem to work.

Nice work btw
 

Attachments

  • CustomWeather.zip
    28.7 KB · Views: 99
@8BitArchitect:

If you would like to share your work with other RaR players, you could also announce it in
[Religion and Revolution]: Contributions from Community

There are also several other RaR modmodders around.
Maybe you guys can find a common vision and work together.
 
After fixing typos and line indents I got the new options (Land, Hill and Peak Percent) to be available and they seem to work.

Nice work btw

Thanks Buck (Can I call you that?)

I forgot that Civ IV doesn't like tabs in it's python code (So used to C++ where whitespace doesn't really matter)

I'm going to try and expose a few more settings to the frontend, and if I can get that working, I guess I'll release it fro public use (Suggestions as to a better name?)
 
Do notice that map size is defined in XML, but is also hardcoded in the map script. I'm not sure what will happen if they go out of sync, but somehow I have a feeling that it could go very bad and crash the game.

I opened the script with Python Idle
If you managed to get Python Idle to work with the game, then please write a guide for it as a number of other people are unaware of how to do that (myself included). I think the correct place for such a guide would be the DLL/Python subforum in the civ4 modding forum.

So far all the python I have done have been with Notepad++. It's great to write code in, but not so great when you have to figure out why the code isn't doing what you expected it to do.
 
Do notice that map size is defined in XML, but is also hardcoded in the map script. I'm not sure what will happen if they go out of sync, but somehow I have a feeling that it could go very bad and crash the game.

At least for civ4/bts, you can define custom map sizes in mapscripts, and it will work.

If you managed to get Python Idle to work with the game, then please write a guide for it as a number of other people are unaware of how to do that (myself included). I think the correct place for such a guide would be the DLL/Python subforum in the civ4 modding forum.

So far all the python I have done have been with Notepad++. It's great to write code in, but not so great when you have to figure out why the code isn't doing what you expected it to do.

I meant I just opened the python file and pressed F5 to catch the line indent errors.Guess you could do same with Notepad++. No idea how to debug Civ4 runtime with IDLE.
 
At least for civ4/bts, you can define custom map sizes in mapscripts, and it will work.
Right. It depends on how the map is generated in the DLL (didn't check right now). Still considering that the map size is set in XML, it would have been correct if the mapscript simply ask the DLL for the data. Well if the mapscript overwrites XML rather than cause memory allocation/access issues, then it's not a big issue.
 
Do notice that map size is defined in XML, but is also hardcoded in the map script.

That has always been the case in FaireWeather Mapscript.

I'm not sure what will happen if they go out of sync, but somehow I have a feeling that it could go very bad and crash the game.

Nope. Nothing to worry about.
Mapscripts can define their own sizes for "Worldsize" settings without any problems.
 
Top Bottom