View Full Version : Excel file for editing civ4 xml files


talchas
Mar 23, 2006, 07:16 PM
This is a MS excel file that can be adapted to edit just about any Civ4 xml file. Currently it has the ability to edit units and promotions. Each unit/promotion is one column, and each property is a row. You can both import and export data to and from the xml files.

Before exporting, change cell B1 in whichever sheet you are editing to point to where you want to save the xml file. If you import an xml file, the script will automatically change this to wherever you imported the file from.

You can use the buttons on the left to show and hide groups of items.

When you open the file, excel will probably ask you whether to enable or disable macros. If you disable macros you won't be able to import or export data.

Thanks to Kael for giving me the idea to write this, and the makers of homeworld 2 for giving me the idea to make it based on a series of commands.

EDIT:
Added sheets for unitclasses and techs. Fixed the problem with the civilopedia in the promotion sheet, it is now disabled by default.

sgrig
Mar 24, 2006, 06:34 AM
Wow this is great! It really simplifies the job of editing XML files.

talchas
Mar 26, 2006, 07:32 PM
I forgot to mention that this creates xml files that are usable with my Civilopedia Promotion Info mod, and regular Civ4 will complain if you use this. If you don't want to use my mod, delete the Civilopedia row (row 10) from the xls file and it won't add that tag.

talchas
Mar 31, 2006, 08:02 PM
I've added unitclasses and techs to this now and fixed the promotion problem. What would you people like next?

boneys26
Mar 31, 2006, 11:13 PM
I've added unitclasses and techs to this now and fixed the promotion problem. What would you people like next?


could you do some bottons for all the dif air units there are as were stuck with the old ones:goodjob:

talchas
Apr 01, 2006, 07:42 AM
What do you mean? Are you asking me to make buttons? Because if you are, you wouldn't like the results. I can't draw worth beans.

boneys26
Apr 01, 2006, 07:56 AM
What do you mean? Are you asking me to make buttons? Because if you are, you wouldn't like the results. I can't draw worth beans.


lol I'm the same. oh well do you know how to start a mod i'm new to this and all i've picked up so far is xml :sad:

talchas
Apr 01, 2006, 08:33 AM
Take a look at http://forums.civfanatics.com/showthread.php?t=132476 and the tutorials forum.

Gunner
Apr 02, 2006, 05:04 PM
Wow, this thing is amazing. Thanks talchas :goodjob:

Crighton
Apr 03, 2006, 01:01 PM
sitting at work, found a few good threads then I randomly scroll down and see this thread.

Thank you sir.

~C

boneys26
Apr 04, 2006, 01:40 AM
could you add building infos too? building class infos

woodelf
Apr 04, 2006, 05:04 AM
Wow, quite impressive talchas. It makes me wish I had Excel at home now...

Gunner
Apr 15, 2006, 10:23 AM
Just checking, but should this still work for the new patch?

talchas
Apr 15, 2006, 11:47 AM
I think so. Make sure you reimport all the files though if you want the latest changes and don't have any data in the file you would lose.

wotan321
Apr 18, 2006, 04:52 AM
This looks to be a great app, thanks for the hard work in putting it together. The thing is... I only need it to work on the tech tree of a mod, but the tab for techs gives me an error message when I click on the "Import Tech Data" button. I have changed cell B1 to the correct civ4techinfos.xml file. Anyway, when I press the "import tech data" button... or the Export button for that matter, I get an error msg in Excel that says "FFH-talchas.xls could not be found". What have I done wrong?

Secondly, will this thing work then with new and different techs?

talchas
Apr 18, 2006, 01:40 PM
About the error - not your fault, the xls is adapted from something I did for FFH, and stupid excel must have made it refer to the FFH xls file when I copied it over. Since I only tested when the FFH xls was in the same folder, I never saw it.

It will work with new techs as long as they follow the same layout. However, it overwrites the old xml file, so import before doing any changes. I'll put out a new, fixed version soon.

wotan321
Apr 18, 2006, 02:13 PM
Thanks, that would be great. We really appreciate your hard work on this.

talchas
Apr 19, 2006, 03:42 PM
Fixed .

stgelven
Apr 27, 2006, 04:06 AM
great work! very usefull i think your tool is the only one xml editor that run properly !

can you make possible to edit all xml files? could be usefull for translation for ex. or editing buildings or whatever possible with civ 4 xml files.

Edit: it seems this version is not compatible with 1.61

erikg88
May 28, 2006, 10:56 PM
Is it possible to make this work with OpenOffice?

zulu9812
May 29, 2006, 05:30 AM
It would be great to see this updated. Civ4 not having a rule editor is a big step back from CivIII, IMO, and even something like an excel file would be most useful.

talchas
May 29, 2006, 06:08 AM
You could do this in openoffice, you would just have to rewrite the macros using python or whatever it uses instead of vba.

DavinciFan
Jun 04, 2006, 05:04 PM
Is it possible to use this to edit other types of XML files? If so, how? I apologize if this seems like a question with an obvious answer, but I am quite new to Civ4 modding. Thanks in advance.

talchas
Jun 05, 2006, 05:08 AM
Its designed to be easy to make edit other Civ4 type XML files. You would make a copy of a sheet and then edit it to fit. The column of commands (Tag, Map, SubMap...) and the column of names would be what you would want to edit.

seady
Sep 22, 2006, 01:24 AM
You could do this in openoffice, you would just have to rewrite the macros using python or whatever it uses instead of vba.


From the open office help file:

"Macros in Microsoft Office and OpenOffice.org"

Microsoft Office and OpenOffice.org cannot run the same macro code. Microsoft Office uses VBA (Visual Basic for Applications) code, and OpenOffice.org uses Basic code based on the OpenOffice.org API (Application Program Interface) environment. Although the programming language is the same, the objects and methods are different.
If you use macros in one of the applications and want to use the same functionality in the other application, you must edit the macros. OpenOffice.org can load the macros that are contained within Microsoft Office files and you can then view and edit the macro code in the OpenOffice.org Basic IDE editor.
You can choose to preserve or delete VBA macros
Open a Microsoft Office document that contains VBA macro code. Change only the normal contents (text, cells, graphics), and do not edit the macros. Save the document as a Microsoft Office file type. Open the file in Microsoft Office, and the VBA macros will run as before.
You may delete the VBA macros from the Microsoft Office file on loading or on saving.
Choose Tools - Options - Load/Save - VBA Properties to set the VBA macro handling of OpenOffice.org.

Darn :) It would have been nice to use as is.

asioasioasio
Sep 22, 2006, 06:22 AM
very good - but maybe i have some errors in my xml or oi made something wrong because importing promotions and units get's run-time error '6' overflow :(
and about techs - it loads only myysticism wich is very weird because i don't have this tech on tech tree :( what could be wrong?

only unitclasses works for me :(

and i have proposition for other xml files editable - could you add civics sheet and leaders and perhaps nations

asioasioasio
Sep 22, 2006, 06:41 AM
if this could help with promotions after clicking debuging
it highlits row = row + 1
Loop
col = startCol
row = startRow
Do Until fout.AtEndOfStream

line = MyTrim(fout.ReadLine)
If line = MyTrim(beginning) Then
col = col + 1
If col > endCol Then
endCol = endCol + 1
newItem
End If
row = startRow
inItem = True
ElseIf line = MyTrim(endTag) Then ' do nothing and wait for the start tag
inItem = False
ElseIf Not inMap Then
Set theMatches = theRegExp.Execute(line)
If theMatches.Count > 0 Then
Set theMatch = theMatches.Item(0)
tag = theMatch.SubMatches(0)
value = theMatch.SubMatches(1)
Do Until ("Tag" = Cells(row, commandColumn) Or "OptionalTag" = Cells(row, commandColumn)) And tag = Cells(row, commandColumn + 1)
Cells(row, col) = ""
row = row + 1
Loop

looking on this code secend row from down

asioasioasio
Sep 22, 2006, 09:41 AM
for thousend times thx. this is very good and flexible tool and very useful :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown:
now i know what's the problem with this error - i've tried to load with warlords code - and when i added rows with warlords tags now it works very good

and what about leaders and nations and civics - is it possible you'll add them? :)

talchas
Sep 22, 2006, 02:49 PM
You could do it yourself you know, just copy one of the existing sheets and edit... ;)

asioasioasio
Sep 22, 2006, 04:16 PM
hehe ok i found out it's quite easy. i'm trying to make the sheet for builduings :)

talchas
Sep 22, 2006, 05:11 PM
That was the idea, that way I could easily add more, and easily push the work off on other modders. :)

Ket
Sep 22, 2006, 11:47 PM
for thousend times thx. this is very good and flexible tool and very useful :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown: :bowdown:
now i know what's the problem with this error - i've tried to load with warlords code - and when i added rows with warlords tags now it works very good

and what about leaders and nations and civics - is it possible you'll add them? :)

Can you post the units sheet for warlords?

asioasioasio
Sep 23, 2006, 07:18 AM
If author has nothing against it i'll post it :)

talchas
Sep 23, 2006, 08:01 AM
Sure .

superjib
Oct 05, 2006, 03:58 AM
So asioasioasio ?
Thanks !

asioasioasio
Oct 05, 2006, 04:51 AM
I'll upload it today
still have some bugs with new sheet for builduings, maybe anyone could check and fix it. -
The games put errors about bad Tags - with empty text (for people who edited xml files - The same bug is when you have for example this tag <prereqTech></prereqTech> instead <prereqTech>NONE</prereqTech> - the game returns error about bad tag than). It's hard to explain it for person wich use english as a second language, but i hope you'll fix it).

asioasioasio
Oct 05, 2006, 10:24 AM
ok hope someone could fix the builduings
or have other useful sheets

morgan33
Jul 11, 2008, 08:13 PM
I am lost. i play civ4 BTS single player and would love to edit my units. now i must go to world editor and then add all promotions to the units i would like to have in the game. that takes forever. i have the exel editor with macros enabled and have tried to do it but have just gotten lost. i have seen when using the world editor that i can add scripts, but uhmm i do not know where to get them or how to make them. any help here would be... well helpful, lol