SRUNITS.CSV hates me!

If you have the desire to modify SR2010 here is where you can discuss and share your designs and ideas. NOTE: Mods are a change to the original program and are not supported by BattleGoat Studios.

Moderators: Balthagor, Legend, Moderators

Post Reply
Cirdan
Warrant Officer
Posts: 38
Joined: Dec 16 2006

SRUNITS.CSV hates me!

Post by Cirdan »

I tried opening SRUNITS.CSV with Gnumeric and did the tes of changing the conscript unit's name. Everything seemed fine in the mapeditor, except (although i did not realise it at first) most units were gone and all the remaining ones (including aircraft, missiles and ships) had been turned into unmounted infantry. But i did not notice as the first few units were present and unchanged. So thinking all was fine, i went ahead and made a bunch of changes, saved and re-imported the units file. That's when i realised the problem, as most of the units were still missing, and the rest were still unmounted infantry--even the planes and stuff. Despite investigating the file in notepad, the only difference from the original (other than my modifications of existing units) was that it now held more commas after the end of a line. Further testing showed that simply opening and saving the file with Gnumeric was enough to induce these errors. Since the Wiki recommends OpenOffice or Excel, i downloaded OpenOffice 2.1 and tried with that. Although i followed all the recommendations, included those dispensed in the previous "more Srunits.csv woes" thread, i could not get it to give me a workable file. Not to mention that, in any case, OO Calc is a bloody piece of garbage that will not refrain from turning half the numerical data into dates, with no way to turn it off. I wonder how software developpers can be so daft as to create software that corrupts your data before you even get a chance to work on it. According to OO help, the only way to turn off that most annoying feature is to wrap the desired numbers in quotes--what's the use of a spreadhseet that can't handle common decimal numbers?

But back on track, can anyone hlep me before i go insane?
User avatar
Balthagor
Supreme Ruler
Posts: 22082
Joined: Jun 04 2002
Human: Yes
Location: BattleGoat Studios

Re: SRUNITS.CSV hates me!

Post by Balthagor »

Cirdan wrote:...I wonder how software developpers can be so daft as to create software that corrupts your data before you even get a chance to work on it...
I have similar feelings towards Excel 2007 beta :evil:

Nonetheless, I'm at a loss. I had suggested OO as an alternative because it did not cause me such problems. Excel 2000/2003 always seemed to export a workable .CSV file for us so we did not really investigate alternatives.

I suppose you could take your changes viewed in notepad, copy them, then use notepad to open the original and past in your changes, but that might be a bother...
Chris Latour
BattleGoat Studios
chris@battlegoat.com
User avatar
ainsworth74
Colonel
Posts: 484
Joined: Apr 17 2004
Location: Middlesborough, UK

Re: SRUNITS.CSV hates me!

Post by ainsworth74 »

Balthagor wrote:I have similar feelings towards Excel 2007 beta :evil:
I would have thought you of all people, the mighty goats, would have known to trust a Microsoft beta as much as a person that has a big yellow sign with flashing lights saying "Don't trust me!!"... :wink:

Your not getting Vista as soon as it comes out are you.... :o
All that is required for evil to prevail is for good men to do nothing.

Sir Edmund Burke
Draken
General
Posts: 1168
Joined: Jul 14 2004
Human: Yes
Location: Space Coast, FL

Post by Draken »

Well... If they are using Visual Studio 2003 or 2005 they would be back very soon to XP....

I had Vista installed for 6 hours before going back to XP Pro ....

Somebody needs to come out with an editor for the unit file....

Will it have a different format in SR2020? Or is it to soon to ask?
User avatar
Balthagor
Supreme Ruler
Posts: 22082
Joined: Jun 04 2002
Human: Yes
Location: BattleGoat Studios

Post by Balthagor »

too soon to ask, but not likely to be the same format (moving to Access on our side). MSO2007 beta was NOT my idea :-?

Though it doesn't affect me too much ATM, busy placing cities...
Chris Latour
BattleGoat Studios
chris@battlegoat.com
Draken
General
Posts: 1168
Joined: Jul 14 2004
Human: Yes
Location: Space Coast, FL

Post by Draken »

moving to Access on our side
YES!

will the unit file be distributed as an access file as well?
User avatar
Balthagor
Supreme Ruler
Posts: 22082
Joined: Jun 04 2002
Human: Yes
Location: BattleGoat Studios

Post by Balthagor »

no idea...
Chris Latour
BattleGoat Studios
chris@battlegoat.com
Cirdan
Warrant Officer
Posts: 38
Joined: Dec 16 2006

Re: SRUNITS.CSV hates me!

Post by Cirdan »

Balthagor wrote:
I suppose you could take your changes viewed in notepad, copy them, then use notepad to open the original and past in your changes, but that might be a bother...
Sigh....i had considered this, but it really is a bother. And since i've tried OO, i think Gnumeric is jealous because it won't open the file properly (but it still will all other .CSVs i can think of, including ones associated with SR2010 such as the people.csv). Damn, i hate spreadsheets; stupid temperamental software that keep trying to second-guess me wasting space on my HD!
User avatar
Balthagor
Supreme Ruler
Posts: 22082
Joined: Jun 04 2002
Human: Yes
Location: BattleGoat Studios

Post by Balthagor »

If you've got a final OO copy, e-mail it too me and I'll export it for you to the .CSV file so you can import.
Chris Latour
BattleGoat Studios
chris@battlegoat.com
Cirdan
Warrant Officer
Posts: 38
Joined: Dec 16 2006

Post by Cirdan »

That's a nice offer, but i can't keep pestering you all the time...serious modding requires regular testing. For the time being i'm editing stuff with notepad, and if it wasn't for the ponderous format of the equipment file it would be sufficient. In the SRUNITS file it is slower than it should be, but i plan on trying with Gnumeric 1.6.3 as opposed to my current 1.7.6 beta build; maybe the stable version will at least be less temperamental.

Besides, i'd need to know how to get OO not to convert numbers to dates first; i really can't understand why this is a common spreadsheet feature, as it is rather useless (turning 1.333 into 1st january 1933?hello? how can i accurately input dates in such a format anyway?) and in many circumstances problematic--many applications need a point rather than a comma for their decimal point.

Oh, and did i mention that since my computer speaks French, the Mars 15 vehicles are, according to OO, March the Fifteenth of the year 2007?

Damn, i really hate spreadsheets.
felinis
Lt. Colonel
Posts: 229
Joined: Jan 10 2006
Location: Baltimore

Post by felinis »

There are two ways that you can do this:

Method A.
Open the same spread-sheet twice - once in notepad, and again in OO Calc or whatever spread-sheet that you intend to use. Copy the SRUNITS.CVS file and paste it back into the same folder. It will be named "Copy of SRUNITS.CSV". Back up your original SRUNITS.CSV file.
Open SRUNITS.CSV in notepad and "Copy of SRUNITS.CSV" in your spread-sheet program.

Display the comma-delimited notepad version at the top half of your screen and the easy-to-read spread-sheet version at the bottom.

Use the bottom version as a map into the cryptic top file.

On the bottom, manipulate the delimiter and the text delimiter when opening the file until your display shows the column headers properly from left to right. The Unique ID number should be in column A.

On the bottom application, select cell D3, then from the main menu select "Window/Split". Now your column headers in the bottom app. will stay displayed at the top while you scroll thru data rows below the split.

Find the value to change in the bottom application, then navigate to the corresponding row in the top notepad version. Place the notepad cursor on the target row and begin to scroll the notepad display to the left.

Compare data patterns between the top and bottom displays. You will soon get the feel for synchronizing the common reference point between the two. The reasoning goes "I am looking for a bunch of "N,N,N,N" characters half way into the row. The "N,N,N,N" pattern will be followed by a "2.1,N,Y,1.0", or "Find the really long row of "N,N,N,N" s and change the sixth one to '10'."

Locate the correct data position in the row and make your change. Make the rest of your changes and then select "File/Save" in notepad.

Method "B" assumes that your spread-sheet program is not changing your floating point numbers (decimal numbers like "1.33") to dates, as you described. If it is doing this, then you may need to change the template for the document to use American date formatting instead of French. Search the OO forums for Calc. They are quite good. Do not ask me, I know about as much about spread-sheets as you do.

Method B.
Use OO Calc version 2.0 to open the SRUNITS.CSV file. Use the default of comma for row delimiter and double quote for text delimiter.
The file display should show the correct column headers from left to right, and the Unique IDs in column A.

Back up your original SRUNITS.CSV file.

Make your changes and save the file as a comma-delimited spreadsheet. Each short row will be extended additional commas to make it as long as the longest row in the original file - that is, all data positions will be delimited even if they were note listed in the original file. This is not a problem - it just makes your file bigger.

The real problem is that all non-numeric data will now be bracketed in double quotes. This is acceptable for the column headers ONLY. All other test data and remarks like the first line "Supreme Ruler 2010 Master Equipment File", must have the double quotes removed (replaced with nothing, no character, null, non, zip, nada).

You can do this with any word processor. Notepad is very slow in finding and replacing that many characters, but you can use it. I use Word or OO Writer. Make sure to save your work as a text file, not as a Word or OO file.

Open the newly edited SRUNITS.CSV file as a text file with your word processor.

If all of your text data is enclosed in double-quotes, then you need to REMOVE all double quote characters from three sections of the file.

The first section is the first line: "Supreme Ruler 2010 Master Equipment File". Remove the double quotes manually.

Skip down past the first set of column headers (there are two sets) and begin selecting the massive amount of data between the forst header section and the second. This first target sections begins with:

1, "Conscript", "0 Infantry",

Keep selecting text using the Shift-Page Down key combination. Stop when you are most of the way thru the document at the line that has "Upgrades" in the third column. This is the second header section for Upgrades.

Once you have performed this huge selection, select "Edit/Find-Replace" from the main menu. Supply the one double quote character for the "Text to find" box and LEAVE THE REPACEMENT TEXT BOX BLANK. You want to REMOVE the double quotes, not replace them with spaces or with anything. Under "advanced settings" indicate that you want to limit the find/replace operation to "Selected Text" only. Press OK to start the replacement. There will be tens of thousands of them.

Save your changes.

Manually remove the double quotes from the third column that reads "Upgrades", then skip down to the actual upgrades data. Select all of the remaining file data, starting with "4001, "Urban Rubble" " and ending at the bottom of the file.

Perform the find/replace operation as described before.

Save your work as a simple text file and close the file, using the same name.

Make sure that the newly edited file is in the /Custom folder. Start the map editor. Press the first "Import Equip. File" icon (the one with the question mark on it). The map editor should read the new SRUNITS.CSV file. You can tell if the app is reading and compiling the file - if you move the mouse cursor away from the icon immediately after pressing it, the tool tip message display will remain displayed for about a count of ten, after which the labels at the top of the screen will change.

You have now compiled a new DEFAULT.UNI file in CUSTOM/DATA. Check its data/time stamp. All normal custom applications will now use these SRUNITS values for unit parameters. If you move the file to MAPS/DATA, then it will be effective even for non-custom and saved games, but you may put yourself out of synch with other players if you play online.
"We have met the enemy and he is us."
Cirdan
Warrant Officer
Posts: 38
Joined: Dec 16 2006

Post by Cirdan »

:o Wow--that was a really long post which goes into great detail. Sadly, it will not be of help because i have finally found out how to get Gnumeric and the map editor to talk to each other. I had to convert the original SRUNITS.csv to UTF-8, import it as text, and then export it as text with the .csv extension (as opposed to saving it as a .csv directly). But it works (and i don't have to change the encoding before editing, my computer just decided that the original file was no longer valid ASCII, for some reason). But i can now happily edit away in Gnumeric :D

And it works, to!
felinis
Lt. Colonel
Posts: 229
Joined: Jan 10 2006
Location: Baltimore

Post by felinis »

Glad that you got your problem solved.

I'm sure that my instructions will be helpful to others.
"We have met the enemy and he is us."
Post Reply

Return to “Mods”