What does blueprints.xml need to work?

Discuss and distribute tools and methods for modding. Moderator - Grognak
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: What does blueprints.xml need to work?

Postby Vhati » Mon Sep 23, 2013 7:44 pm

XionGaTaosenai wrote:
This mod doesn't append. It clobbers.

If that's all it reported, you DO have valid XML, both in the eyes of a strict parser and the custom sloppy parser that tries to mimic FTL's typo tolerance.
XionGaTaosenai
Posts: 36
Joined: Wed Nov 14, 2012 6:04 pm

Re: What does blueprints.xml need to work?

Postby XionGaTaosenai » Mon Sep 23, 2013 8:01 pm

Hm. I think it'd be quickest if you just sent the me your mod so I can see where it fails, and fix the bug...


Wow, really? I never thought anyone would offer to do that. Thanks!

I uploaded my blueprints.xml file to Google Drive. It'll be in no position to actually run the game with just that replacing the default, but hopefully it's enough to help you find out what's going wrong.

If you need anything else, like a .ftl file, I can provide. Should I just place the changed stuff in, or the entirety of data.dat/resource.dat in the .ftl file?
XionGaTaosenai
Posts: 36
Joined: Wed Nov 14, 2012 6:04 pm

Re: What does blueprints.xml need to work?

Postby XionGaTaosenai » Mon Sep 23, 2013 8:07 pm

I had this several times during testing -- never really noticed a pattern why it happens, but I think it should be the error that caused the checker to spill its guts. If you double click it, it'll probably crash the app.


I double-clicked the syntax error in tooltips, and it didn't crash the app, instead just highlighting the copyright notice at the top of the tooltips file, saying something about an "unexpected exception:null".
User avatar
5thHorseman
Posts: 1668
Joined: Sat Mar 02, 2013 2:29 am

Re: What does blueprints.xml need to work?

Postby 5thHorseman » Mon Sep 23, 2013 10:57 pm

XionGaTaosenai wrote:
I had this several times during testing -- never really noticed a pattern why it happens, but I think it should be the error that caused the checker to spill its guts. If you double click it, it'll probably crash the app.


I double-clicked the syntax error in tooltips, and it didn't crash the app, instead just highlighting the copyright notice at the top of the tooltips file, saying something about an "unexpected exception:null".


The problem is, the blueprints.xml that comes with the game also fails to validate XML. You can't find an error that will hurt FTL with a validator, at least not most of the time.

I made the XML valid (by removing the copyright notice and adding a huge wrapper around the rest of the file like you need to to make a valid XML file) and found the problem. It's just after line 600. Search for the text:

image>missile_2</image>

and make it:

<image>missile_2</image>

For reference, here's how I changed the first few lines:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright (c) 2012 by Subset Games. All rights reserved -->


<!--**********ITEM BLUEPRINTS**********-->

<stuff>

<itemBlueprint name="fuel">
...


And here's all I added to the bottom:

Code: Select all

...
</shipBlueprint>

</stuff>


EDIT:
NOTE! Don't make all those changes to your blueprints. That was just to get the validator to work. Only make that change to the image tag.
My Videos - MY MOD HUB
Simo-V - The Potential - Automated Scout - "Low O2" Icons
The Black Opal - The Asteroid - The Enforcer - The Pyro

"Every silver lining has a cloud..."
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: What does blueprints.xml need to work?

Postby kartoFlane » Mon Sep 23, 2013 11:15 pm

Alright, looks like I messed up and put the code informing about the error in the wrong place... That's why it'd never show up, and no log would be created. Fixed

Also, found the culprits:

Missing forward slash (affects all crewBlueprint tags):

Code: Select all

<crewBlueprint name="human">
   <title>Human</title>
   <short>Human</short>
   <desc>Humans are common and uninteresting.</desc>
   <cost>40</cost>
   <rarity>1</rarity>
   <powerList>
      <power>No exceptional traits</power>
   </powerList>
<crewBlueprint> <------ missing forward slash

<image> is missing opening triangle bracket (causing whole world o' hurt):

Code: Select all

<weaponBlueprint name="MISSILES_2_PLAYER">
   <type>MISSILES</type>
   <title>Missiles!</title>
   <short>Missile</short>
   <desc>Missiles go right through enemy ships, but use up limited ammo. Don't run out!</desc>
   <tooltip>Fires 1 missile that does 2 damage, Uses 1 missile</tooltip>
   <damage>2</damage>
   <shots>1</shots>
   <sp>5</sp>
   <fireChance>0</fireChance>
   <breachChance>0</breachChance>
   <cooldown>11</cooldown>
   <power>1</power>
   <missiles>1</missiles>
   <cost>40</cost>
   <rarity>0</rarity>
   image>missile_2</image> <----------- missing opening triangle bracket
   <launchSounds>
      <sound>smallMissile1</sound>
      <sound>smallMissile2</sound>
   </launchSounds>
   <hitShipSounds>
      <sound>smallExplosion</sound>
   </hitShipSounds>
   <hitShieldSounds>
      <sound>hitShield1</sound>
      <sound>hitShield2</sound>
      <sound>hitShield3</sound>
   </hitShieldSounds>
   <missSounds>
      <sound>miss</sound>
   </missSounds>
   <weaponArt>missiles_1</weaponArt>
</weaponBlueprint>

Some of your weapons are also missing <weaponArt> tags, but that's something the checker will be able to detect.
Superluminal2 - a ship editor for FTL
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: What does blueprints.xml need to work?

Postby Vhati » Tue Sep 24, 2013 1:16 am

5thHorseman wrote:The problem is, the blueprints.xml that comes with the game also fails to validate XML. You can't find an error that will hurt FTL with a validator, at least not most of the time.


Search for the text:

image>missile_2</image>

and make it:

<image>missile_2</image>

That's exactly the sort of thing I was hoping to find.
I would've thought the sloppy parser might accept that, but that the strict one would choke and hint at the location (that it'd be treated as an extraneous mismatched closing tag).

I consider it a bug in the Validate feature that this wasn't listed.
I'll see if I can add a check for this.
Last edited by Vhati on Tue Sep 24, 2013 1:21 am, edited 1 time in total.
XionGaTaosenai
Posts: 36
Joined: Wed Nov 14, 2012 6:04 pm

Re: What does blueprints.xml need to work?

Postby XionGaTaosenai » Tue Sep 24, 2013 1:20 am

Alright, everything's going smoothly now. There are a few errors I still need to fix, but the Error Checker is working right again and my plans can continue hopefully without another hitch. Thanks for the help, and thanks for making the error checker in the first place; it's going to be a godsend for me.

So how come it detected the error with the Medbay, and then nothing else after I fixed that?
Last edited by XionGaTaosenai on Tue Sep 24, 2013 1:39 am, edited 1 time in total.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: What does blueprints.xml need to work?

Postby Vhati » Tue Sep 24, 2013 1:31 am

Vhati wrote:
5thHorseman wrote:The problem is, the blueprints.xml that comes with the game also fails to validate XML. You can't find an error that will hurt FTL with a validator, at least not most of the time.

That's exactly the sort of thing I was hoping to find.
I would've thought the sloppy parser might accept that, but that the strict one would choke and hint at the location (that it'd be treated as an extraneous mismatched closing tag).

Uhh... I just dropped the file from google drive into an empty folder named data, zipped it, and I got this from SMM's Validate.

Code: Select all

> data/blueprints.xml

~ Strict XML Parser Issues:
  ! <?xml... ?> should only occur on the first line.
  ! <persDamage...>...</persdamage>
  ! <shipBlueprint>...</ship>
  ! Fix this and try again:
  org.jdom2.input.JDOMParseException: Error on line 604: The element type "weaponBlueprint" must be terminated by the matching end-tag "</weaponBlueprint>".
  ~  ~  ~  ~  ~
        image>missile_2</image>
  ~  ~  ~  ~  ~

~ This mod doesn't append. It clobbers.


So it IS working as intended.



And adding the missing bracket, changes the report to this...

Code: Select all

> data/blueprints.xml

~ Strict XML Parser Issues:
  ! <?xml... ?> should only occur on the first line.
  ! <persDamage...>...</persdamage>
  ! <shipBlueprint>...</ship>
  ! Fix this and try again:
  org.jdom2.input.JDOMParseException: Error on line 2114: The element type "weap
onList" must be terminated by the matching end-tag "</weaponList>".
  ~  ~  ~  ~  ~
        </weaponlist>
  ~  ~  ~  ~  ~

~ This mod doesn't append. It clobbers.


Correct and repeat...

Code: Select all

  ! Fix this and try again:
  org.jdom2.input.JDOMParseException: Error on line 2167: The element type "weap
onList" must be terminated by the matching end-tag "</weaponList>".
  ~  ~  ~  ~  ~
        </weaponlist>
  ~  ~  ~  ~  ~



Seeing a pattern, I fix all the weaponLists...

Code: Select all

  ! Fix this and try again:
  org.jdom2.input.JDOMParseException: Error on line 3248: The element type "crew
Blueprint" must be terminated by the matching end-tag "</crewBlueprint>".
  ~  ~  ~  ~  ~
  </wrapper>
  ~  ~  ~  ~  ~


Searching for crewBlueprint reveals this...

Code: Select all

<crewBlueprint name="human">
   <title>Human</title>
   <short>Human</short>
   <desc>Humans are common and uninteresting.</desc>
   <cost>40</cost>
   <rarity>1</rarity>
   <powerList>
      <power>No exceptional traits</power>
   </powerList>
<crewBlueprint>

That last tag doesn't have a leading slash.
This pattern is repeated for all crewBlueprints...


Fixing those, it finally reports nothing.
Last edited by Vhati on Tue Sep 24, 2013 1:56 am, edited 2 times in total.
XionGaTaosenai
Posts: 36
Joined: Wed Nov 14, 2012 6:04 pm

Re: What does blueprints.xml need to work?

Postby XionGaTaosenai » Tue Sep 24, 2013 1:43 am

So it IS working as intended.


It was probably a mistake on my part; I probably made the .ftl file wrong, and I didn't bother to reinstall FTL so that SMM would work properly. I just threw it up halfheartedly to see if it caught anything that the Error Checker didn't, and I thought that comment was funny.

Doing what Karto suggested and installing the updated Error Checker fixed the hurdle I was dealing with, so I'll probably have everything going fine shortly. Thank you all for the help!
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: What does blueprints.xml need to work?

Postby Vhati » Tue Sep 24, 2013 2:13 am

I should add...
5thHorseman wrote:I made the XML valid (by removing the copyright notice and adding a huge wrapper around the rest of the file like you need to to make a valid XML file)
[...]
EDIT:
That was just to get the validator to work.

Adding your own wrapper has no effect.

SMM always adds <wrapper>...</wrapper> under the hood, just to get parsers to look at FTL's resources.