Civ4 XML Editor

General Tso

Panzer General
Joined
Oct 12, 2007
Messages
1,547
Location
U. S. of A.
This is an XML editor for Civ4 that is extremely easy to use. It should cut the amount of time you spend editing XML files dramatically. It sorts the data from the xml file and makes it easier to read. You just have to click on a given item to bring up a dialog box that allows you to edit it.

Once you open the editor, try clicking on the Help button for some ideas on how to use it.

The version is now 1.13 - To use it, just download it, open the folder, and click on the "Civ4 XML Editor" shortcut.

Improvements in 1.13:
The editor now does a much better job of loading files that have been named differently than the ones that came with the game. If you're editing a mod with non standard file names you shouldn't have to use the "Type" button. You probably won't need the "Type" button at all, but I left there just in case.

Other recent improvements:
The editor now loads an XML file if one is passed to it when it opens. That means you can now make Civ4 XML Editor your delault program for xml files and double clicking on a file will open it within the editor. If you want to move your Civ4 XML Editor program folder, it would be best to do it before making it the default program for your xml files. It's a Windows thing.
You can also use the "Send To" option in the Windows right click menu to load files. To make the "Send To" option work, you will need to drag a shortcut of the editor into your SendTo folder.
Added support for negative numbers. (I don't know how I missed that one.)
Added Clone and Delete to the Class List. These commands can be used to quickly add or remove items like units or buildings in the game. You will still have to edit some values in it's Element List to finish the item, but the editor makes that easy.
Added new edit options to the Element List: Add, Clone, and Delete.
Added "Show Edit Help" option - when it's active the various edit options are displayed for each element.
Added option for larger text box when editing text.
Added some code to handle different types of file encoding.
Added the ability to search within the class list and the element list.


Download here:
Civ4 XML Editor Download


You can check out the screen shots below to see what the editor looks like.
 

Attachments

  • Screen Shot 1.jpg
    Screen Shot 1.jpg
    161 KB · Views: 5,016
  • Screen Shot 2.jpg
    Screen Shot 2.jpg
    140.5 KB · Views: 3,505
The program should open when you double click on it's icon (Civ4 XML Editor.pyw). What happens when you click on it? Do you get any messages?
 
There is a simple text file included with the program that explains how the program works. Since the information in that file is pretty basic, I thought I would give a better description on how get started here.

1. Use the load button to load an XML file. XML\Units\Civ4UnitInfos.xml would be a good one to start with.

2 The left side box now contains a list of all the units in the game. They are displayed as UNIT_LION, UNIT_BEAR, ..... etc. You can change the current unit by clicking on this list.

3. The right side box contains a list of the elements for the selected unit. Any data element can be edited by clicking on it. This brings up a dialog box which allows you to quickly change the value. There are four kinds of dialog boxes. Integer, Floating Point, Boolean, and Text.

4. When you are finished, click on the save button. This will bring up a dialog box that allows you to save the file.
 
When you download the program there should have been two files located inside a zip file. Unzip these to your desktop. One file is a short text file with some information about the program, it's called "Civ4 XML Editor Help.txt". The other file is the program itself, it's called "Civ4 XML Editor.pyw". This program doesn't need to be installed, just double click on it and it should run, but you do need to install the Python interpreter before running the program.
 
1. Yes it works with BTS. I havn't tried it with the other versions of Civ4, but it should work with them also.

2. The load button is located within the the program. The directions above should become clear once you open the program. I'll try to post a screen shot tonight if I get a chance. That might make things a little clearer. The computer I'm on right now doesn't have any software to reduce a screen shot down to a manageable size.
 
Nothing happens when I double-click on the pyw file. In what folder should that file be installed?

I installed the Python interpreter in the Programs File folder.

-----------------------------

EDIT -- I placed the pyw file on my desktop. Doesn't launch from there either.
 
If Python was installed properly then the Python interpreter should automatically run the program when you double click on the icon.
If you don't mind taking a moment to try something, we might be able to find the problem.
Go to Start menu \ Programs \ Python 2.5 \ IDLE (Python GUI)
This should open IDLE which is the default Python editor.
Use the file menu in IDLE to open "Civ4 XML Editor.pyw" - you will have to move to the folder where it is located first.
With the IDLE window active press F5 (function key). This will cause the program to run. IDLE will also open a second window (other than the program window) - look at this window and see if there are any error messages.
Let me know what happens and I'll try and straighten it out.
 
When I hit F5, the editor returns the following error msg:

Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\Desktop\Civ4 XML Editor.pyw", line 9, in <module>
from win32ui import CreateFileDialog
ImportError: No module named win32ui
 
Thanks Ambreville,
I think I see the problem now, I'm using some third party software that must include that module. Let me try and find a solution and I'll post an updated version.
 
General Tso try this out Py2exe.org.

It's pretty easy and prevents people from having to download stuff onto their computer to use your app. A big turn off for man such as myself.

ClassicThunder
 
General Tso try this out Py2exe.org.

It's pretty easy and prevents people from having to download stuff onto their computer to use your app. A big turn off for man such as myself.

ClassicThunder

Can you elaborate?
 
Thanks for the info ClassicThunder, I should have a new and improved version up shortly.
 
@General Tso

No problem I'm glad to help.

@Jesus Civs

That script can compile another python script into an easily distributable .exe. Unfortunately its a little messy but you no longer need to have the python translator. Only the .net framework
 
Use notepad.

newbs.
 
Top Bottom