Fractal Softworks Forum
April 18, 2019, 03:29:03 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Starsector 0.9a is out! (11/16/18); In-dev patch notes for 0.9.1a (01/31/19)
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Saved Variant Extractor  (Read 12990 times)
Wyvern
Admiral
*****
Posts: 2187


View Profile
« on: January 22, 2013, 12:25:27 AM »

Built myself a simple little java program to extract ship variants from a saved game and convert them into .variant files suitable for inclusion in a mod.

Why is this useful?  It means you can use the in-game editor - which is quite helpful if you want to, say, design a variant that could be legally designed by someone with some specific set of skills.  (How many ordnance points does an onslaught have when you have level four technology aptitude?  I don't know, and have no interest in doing the calculations myself.)

Anyway.  To use, compile the provided code, then run it; it takes a single command line argument, which is the path to the campaign.xml file for the saved game you want to extract variants from.  It generates a set of .variant files stored in the saved game folder; you can then move those wherever.

Yeah, I could clean it up some - provide command line help, maybe package it into a jar with a basic UI so you don't need to worry about compiling it yourself - but, eh.  Made this for my own use; I may do some of that work later if there's enough outside interest.

[attachment deleted by admin]
Logged

Wyvern is 100% correct about the math.
silentstormpt
Admiral
*****
Posts: 1055



View Profile
« Reply #1 on: January 22, 2013, 02:15:02 AM »

Thanks for your work, i never thought of using the saved game to grab saved refit variants
Logged
Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #2 on: May 31, 2013, 06:20:49 PM »

Hey guys, Sorry for the necro, But I REALLY need this for my station ships, Any chance you could teach me how to compile it? or improve it to an EXE file?
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
Wyvern
Admiral
*****
Posts: 2187


View Profile
« Reply #3 on: May 31, 2013, 07:37:08 PM »

So, if you've got java installed, you should be able to run "javac SavedVariantConverter.java", and then run the app by "java SavedVariantConverter /path/to/save/campaign.xml".  I can package it into a runnable jar for you, but not immediately; I've got some family emergency type issues to attend to for the next week and a half.  If you really can't get it working yourself, and need it sooner than I can get to it, then you can ask around for someone else to help - for example, I'm sure LazyWizard would be able to help, and there are probably others.

Apologies, but I just can't guarantee the time to offer any further help just now.
Logged

Wyvern is 100% correct about the math.
Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #4 on: May 31, 2013, 07:40:01 PM »

I'd really appreciate it if you could package it, But no rush Smiley
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
LazyWizard
Global Moderator
Admiral
*****
Posts: 1253



View Profile WWW
« Reply #5 on: June 03, 2013, 04:34:58 AM »

I took the liberty of making a very rough jar for those who don't want to compile this for themselves. The only changes I made to the script itself was to add a file selector so you don't need to use the command line (command line options should still work, though), and have the program open the save directory after the variants have been extracted to save time.

If you run into any bugs, it's completely my fault. I threw this together in a few minutes. Smiley
« Last Edit: June 03, 2013, 04:45:44 AM by LazyWizard » Logged

Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #6 on: June 03, 2013, 07:12:32 AM »

There he goes again!

Bloody hell lazy!

Will you stop!

Being so damn AWESOME ;P
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #7 on: June 04, 2013, 08:07:33 PM »

I took the liberty of making a very rough jar for those who don't want to compile this for themselves. The only changes I made to the script itself was to add a file selector so you don't need to use the command line (command line options should still work, though), and have the program open the save directory after the variants have been extracted to save time.

If you run into any bugs, it's completely my fault. I threw this together in a few minutes. Smiley

It doesnt work Tongue
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
LazyWizard
Global Moderator
Admiral
*****
Posts: 1253



View Profile WWW
« Reply #8 on: June 04, 2013, 08:48:50 PM »

Any details on how it doesn't work?

How are you running it? If you add the word pause to a new line in the bat file (assuming you run Windows), what text is on the screen when the program is done?
Logged

LazyWizard
Global Moderator
Admiral
*****
Posts: 1253



View Profile WWW
« Reply #9 on: June 04, 2013, 09:19:52 PM »

Ah, I see, the script doesn't check for write permissions. I didn't run into it because I install my games into my user directory.

Here's a quick, very ugly patch.
Logged

Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #10 on: June 04, 2013, 10:57:34 PM »

Cheers, will take a look tomorrow Smiley
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
Sproginator
Admiral
*****
Posts: 3590


Forum Ancient


View Profile
« Reply #11 on: June 05, 2013, 04:47:30 PM »

Works perfectly! Please sticky this someone Cheesy
Logged

A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)
pablo
Ensign
*
Posts: 4


View Profile Email
« Reply #12 on: August 21, 2013, 06:08:06 PM »

It dosen't work for me. What Java version you use ?
Logged
DrakonST
Captain
****
Posts: 333


Lizard-Wizard


View Profile Email
« Reply #13 on: November 14, 2016, 05:22:42 PM »

It doesn't work any more? When I use this program she takes empty variants. Without weapon and hullmods.

Code:
{
  "displayName": "Advanced II",
  "fluxCapacitors": 0,
  "fluxVents": 47,
  "hullId": "valk_almire_II",
  "hullMods": [
  ],
  "variantId": "valk_almire_II_Advanced II",
  "weaponGroups": [
    {
      "autofire": false,
      "mode": "ALTERNATING",
      "weapons": {
      }
    },
    {
      "autofire": true,
      "mode": "LINKED",
      "weapons": {
      }
    },
    {
      "autofire": true,
      "mode": "LINKED",
      "weapons": {
      }
    },
    {
      "autofire": false,
      "mode": "LINKED",
      "weapons": {
      }
    },
    {
      "autofire": false,
      "mode": "LINKED",
      "weapons": {
      }
    },
  ]
}
Logged

I a Russian. And i communicate with the help of Promt Translate. And I am a color-blind person.
Wyvern
Admiral
*****
Posts: 2187


View Profile
« Reply #14 on: November 14, 2016, 07:07:20 PM »

Hm.  Probably the code is a bit out of date with recent updates to Starsector.  ...Unfortunately, I seem to have misplaced the original source code, which makes it a bit hard to update.

I can try to get a working version of this put together again this weekend, though; it was pretty simple to make the first time, so it shouldn't be that much harder to rebuild from scratch.  (Or, if the version you've got includes source code, I can PM you my email address, have you send me the existing version, and then work from that.)
Logged

Wyvern is 100% correct about the math.
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2006-2011, Simple Machines
Simple Audio Video Embedder
Valid XHTML 1.0! Valid CSS!