Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Saved Variant Extractor  (Read 13396 times)

Wyvern

  • Admiral
  • *****
  • Posts: 2195
    • View Profile
Saved Variant Extractor
« on: January 21, 2013, 04:25:27 PM »

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
Re: Saved Variant Extractor
« Reply #1 on: January 21, 2013, 06:15:02 PM »

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
Re: Saved Variant Extractor
« Reply #2 on: May 31, 2013, 11:20:49 AM »

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: 2195
    • View Profile
Re: Saved Variant Extractor
« Reply #3 on: May 31, 2013, 12: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
Re: Saved Variant Extractor
« Reply #4 on: May 31, 2013, 12:40:01 PM »

I'd really appreciate it if you could package it, But no rush :)
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: 1259
    • View Profile
    • Bitbucket Profile
Re: Saved Variant Extractor
« Reply #5 on: June 02, 2013, 09:34:58 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. :)
« Last Edit: June 02, 2013, 09:45:44 PM by LazyWizard »
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3590
  • Forum Ancient
    • View Profile
Re: Saved Variant Extractor
« Reply #6 on: June 03, 2013, 12: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
Re: Saved Variant Extractor
« Reply #7 on: June 04, 2013, 01: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. :)

It doesnt work :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)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1259
    • View Profile
    • Bitbucket Profile
Re: Saved Variant Extractor
« Reply #8 on: June 04, 2013, 01: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: 1259
    • View Profile
    • Bitbucket Profile
Re: Saved Variant Extractor
« Reply #9 on: June 04, 2013, 02: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
Re: Saved Variant Extractor
« Reply #10 on: June 04, 2013, 03:57:34 PM »

Cheers, will take a look tomorrow :)
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
Re: Saved Variant Extractor
« Reply #11 on: June 05, 2013, 09:47:30 AM »

Works perfectly! Please sticky this someone :D
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
Re: Saved Variant Extractor
« Reply #12 on: August 21, 2013, 11:08:06 AM »

It dosen't work for me. What Java version you use ?
Logged

DrakonST

  • Captain
  • ****
  • Posts: 340
  • Lizard-Wizard
    • View Profile
    • Email
Re: Saved Variant Extractor
« Reply #13 on: November 14, 2016, 09:22:42 AM »

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: 2195
    • View Profile
Re: Saved Variant Extractor
« Reply #14 on: November 14, 2016, 11:07:20 AM »

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