Jump to content

Platform-Independent 0.20 Part.cfg Updater


ChaserGrey

Recommended Posts

Ph34rb0t posted a .bat file here that automatically updates part.cfg files from before 0.20 to the new format, allowing large packs like NovaPunch to be used with 0.20 without having to manually update hundreds of files. Unfortunately, I run a Mac, and I know some other folks are probably in the same boat.

So, I created a Python script that does the same thing and runs on Mac and UNIX. (Runs on Windows too, but it's more work than ph34rb0t's .bat file so you're honestly better off with that) To use it, do the following:

  1. Download a Python interpreter. You can get one for free here from Python.org. Make sure you get Python 3.3.
  2. Download the script here
  3. Associate the interpreter with the ".py" file type. On Mac you can do this by right-clicking a ".py" file, picking "Get Info", opening the "Open With" tab, and choosing "Python Launcher". Not sure how to do it on other systems.
  4. Set up your folders. Make a folder inside "GameData" named after the mod you want to update, e.g. "NovaPunch". Inside that folder, make one called "Parts". Inside the "Parts" folder, set up sub folders using one or more of the following category names, the same as Squad uses for their parts: "Aero", "Command", "Electrical", "Engine", "FuelTank", "Structural", "Utility", and "Wheel". You do not have to use all of these names, as long as you use some of them. Move your parts into these folders, according to the category you want them to show up under in the VAB/SPH
  5. Copy the "main.py" script into the "Parts" folder.
  6. MAKE ABSOLUTELY SURE that the script is in the "Parts" folder, that the folder contains one or more of the category folders given above, and that those category folders contain ONLY parts folders- no interiors, ships, etc. Failure to do so will cause the script to crash.
  7. Run the script. On Mac, you should be able to do that by just clicking as long as you have associated the .py file type with your Python Interpreter.

Note that this only updates the part.cfg files. If the 3D models for the parts don't work with 0.20, this doesn't do anything about that. But it gets you part of the way there until the addon folks get to do proper updates.

Tested on my copy of KSP 0.20 on Mac OS 10.7 and it works fine. Hope others find this useful as well.

Link to comment
Share on other sites

Hi,

Wow this is gonna be a boon...I actually havnt used these mods yet - well I tried the Nova group in 18 and I had problems...thanks for this !

Definitely cheking out.

(EDIT: I am using Py2.77 will this be a problem with KSP v.20? Thanks! Python isnt actually used running the game is it?)

Cdr Zeta

Edited by Cdr_Zeta
Link to comment
Share on other sites

Okay, now we've got Macs covered. Great work!

[Edit: I've linked to your script in my post.]

The only thing missing now is Linux (but I think everyone has the Python libraries installed anyway).

is wrapping the file in PART{} the only difference between .19 and .20 cfg files?

Basically yes, but some (older) parts have scaling problems with their attachment nodes in 0.20 and thus need to be modified as well.

Edited by Ph34rb0t
Link to comment
Share on other sites

(EDIT: I am using Py2.77 will this be a problem with KSP v.20? Thanks! Python isnt actually used running the game is it?)

No, this is just a script that wraps all your parts in PART {} so they can be loaded in 0.20. I'm new to Python and have only used 3.3, so I don't know enough to say whether 2.77 will be able to run it. ...You should probably be fine, but I'd back your parts up just in case.

is wrapping the file in PART{} the only difference between .19 and .20 cfg files?

It's the only one that's amenable to mass editing like this. As ph34rb0t mentioned there may be attachment issues but that's probably something you'll have to sort out on a part by part basis. Personally, I'm just avoiding those parts for now and waiting for a 0.20 compatible version of my favorite packs, but then a) my favorites are still being maintained and B) I'm lazy like that.

Okay, now we've got Macs covered. Great work!

[Edit: I've linked to your script in my post.]

The only thing missing now is Linux (but I think everyone has the Python libraries installed anyway).

Thank you and thank you! Python is platform-independent (similar to Java) and I believe there's a Unix-compatable version on the site I linked to.

Link to comment
Share on other sites

I'm new to Python and have only used 3.3, so I don't know enough to say whether 2.77 will be able to run it. ...You should probably be fine, but I'd back your parts up just in case.

The difference between python 2.x and 3.x is very big, but your script will run without modification, since it's very simple. They're more like two similar languages.

Also, in 3.x you should write print('foo'), not print 'foo', and consider reading PEP 8.

Link to comment
Share on other sites

Howdi,

As it turns out I have a PC not a MAC so Python wasnt an issue for me; a BAT file solves the Part{} problem nicely; I am still looking for a similar program (PC!) to simply replace/add "Scale = 1" :can we get this !!??

I ran the BAT file on one set of parts; I intend to run it on others but the Scale = 1 is gonna be a PITD; not that it cant be done; I am just kinda lazy.

The old parts were abit off scale and didnt look good; I think scaling will auto-fix any node issues but I dunno on that one.

I will manually add the lines and see what gives on the parts tonite and let yas know; gives me sumthin to do while I am lost in space now and my Kerbal Team has to find me in like 90 days or I am toast !

Cdr Zeta

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...