CSV To INI

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Post Reply
User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

CSV To INI

Post by milo christiansen » 01 Mar 2013, 02:09

A simple csv to ini converter

For every different type of csv file you need to convert to ini you will need to write a xml conversion specification, examples are included in the package.

Included are binarys for Windows in both 32 and 64 bit. Everybody else can just go compile it themselves :wink:
More info in the readme.

To generate an ini file from the contents of more than one csv file you will need more than one pass. Details in the readme.

If more flexability is needed just ask.
Attachments
CSV To INI.7z
version 2
(868.92 KiB) Downloaded 410 times
Last edited by milo christiansen on 08 Mar 2013, 23:07, edited 1 time in total.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: CSV To INI

Post by Goth Zagog-Thou » 01 Mar 2013, 02:26

Will try this out immediately. Thanks Milo. :D

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: CSV To INI

Post by milo christiansen » 01 Mar 2013, 02:41

Have fun :wink:
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: CSV To INI

Post by Reg312 » 01 Mar 2013, 08:47

windows users also can try this: https://github.com/crabster/Warzone-Sta ... sConverter
(source code included)
supports conversion for research.ini and structure.ini

User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: CSV To INI

Post by Goth Zagog-Thou » 06 Mar 2013, 00:21

Milo, I have no idea what to do with those .xml files, buddy. Sorry.

User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base
Contact:

Re: CSV To INI

Post by Goth Zagog-Thou » 06 Mar 2013, 02:59

It seems that the crabster github no longer exists. Shame.

User avatar
effigy
Regular
Regular
Posts: 1217
Joined: 22 Jan 2010, 03:21
Contact:

Re: CSV To INI

Post by effigy » 06 Mar 2013, 07:16

Eh? Crabster... :(
This is why some features aren't implemented: http://forums.wz2100.net/viewtopic.php?f=30&t=7490&view=unread#p87241

Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: CSV To INI

Post by Originway » 06 Mar 2013, 19:49

effigy wrote:Eh? Crabster... :(
rage quit?
O_o

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: CSV To INI

Post by milo christiansen » 08 Mar 2013, 23:03

@Goth: Simple, let me go get a copy...

Note that this is for version 2

Code: Select all

<section> 
    <!-- NCA code to generate section name. Runs once per record. -->
    <namecode>(fmtstr "Record Number:%d Field 0:%s" (getrecord) (getfield 0)</namecode>

<key> 
    <index>1</index> <!-- csv field number to use for this key's value -->
     <name>test1</name> <!-- this keys name -->
</key>
</section>
The namecode tag has some simple code to generate the section name, for most cases you just need to put "(getfield 0)" here. That will get the first field in the record and make it the section name. (a record is a line in csv)

Then for each key in the section you need a key tag. index is the record number to use for that key's value and name is the string to use as the name for that key.

Run the example and look at the output, it's very simple.

A simple example:
csv file:

Code: Select all

test #1,1,2,3,4,5
test #2,1,2,3,4,5
test #3,1,2,3,4,5
test #4,1,2,3,4,5
test #5,1,2,3,4,5
xml file:

Code: Select all

<section>
	<!-- NCA code to generate section name. Runs once per record. -->
	<namecode>(getfield 0)</namecode>
	
	<key>
		<index>1</index> <!-- csv field number to use for this key's value -->
		<name>test1</name> <!-- this keys name -->
	</key>
	<key>
		<index>2</index>
		<name>test2</name>
	</key>
	<key>
		<index>3</index>
		<name>test3</name>
	</key>
	<key>
		<index>4</index>
		<name>test4</name>
	</key>
	<key>
		<index>5</index>
		<name>test5</name>
	</key>
</section>
Result:

Code: Select all

[test #1]
test1=1
test2=2
test3=3
test4=4
test5=5

[test #2]
test1=1
test2=2
test3=3
test4=4
test5=5

[test #3]
test1=1
test2=2
test3=3
test4=4
test5=5

[test #4]
test1=1
test2=2
test3=3
test4=4
test5=5

[test #5]
test1=1
test2=2
test3=3
test4=4
test5=5
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

Originway
Trained
Trained
Posts: 412
Joined: 08 Aug 2012, 06:22

Re: CSV To INI

Post by Originway » 15 Mar 2013, 01:10

Originway wrote:
effigy wrote:Eh? Crabster... :(
rage quit?
O_o
he still holding a grudge?

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: CSV To INI

Post by milo christiansen » 20 Mar 2013, 17:16

If anyone makes a conversion descriptor file, post it here, that way I know which ones I can skip when I get around to making them :wink:
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

Post Reply