Ship Comparison (Release)

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship Comparison (Release)

Post by phkb »

gsagostinho wrote:
the amount of cargo of my Cobra Mk. IV OXP is being shown as "45", but it should actually be "45 (+15)"
This is a limitation on what information I can access at runtime. The default amount of extra cargo (if none is specified in shipdata.plist) is 15. However, that setting only comes into play if the ship has an option for a large cargo bay specified in shipyard.plist. I can't read details from shipyard.plist at runtime, which means all I have access to is the shipdata.plist file, which means if no extra cargo is specified there, it's hard to assume it's actually allowed.

There are two ways around this. First, you could specify the extra cargo in your shipdata.plist file - if it's specifically set, I can assume it's correct.

Alternatively, I have a list of exceptions inside Ship Comparisons which controls the two settings I can't read from shipyard.plist: large cargo bay, and weapon facings. For future reference (and I'll put this on the wiki page as well), to override these values you can do this:

Code: Select all

    worldScripts.ShipComparison._extraData["Cobra Mark IV"] = [15, 15];
The ship name should be the generic name for the ship, rather than the shipkey (although if you have a specific variant of the generic you want to include you can do that as well), and the two numbers are "amount of extra cargo" and "weapon facings" (where 15 means all positions).

In any case, I've uploaded v1.8 of Ship Comparisons which add the Cobra Mark IV to the list of exceptions, so you don't need to do anything for this ship now.

Thanks for letting me know!
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Ship Comparison (Release)

Post by gsagostinho »

phkb wrote:
The default amount of extra cargo (if none is specified in shipdata.plist) is 15. However, that setting only comes into play if the ship has an option for a large cargo bay specified in shipyard.plist. I can't read details from shipyard.plist at runtime, which means all I have access to is the shipdata.plist file, which means if no extra cargo is specified there, it's hard to assume it's actually allowed.
That makes complete sense to me, didn't think about it!
There are two ways around this. First, you could specify the extra cargo in your shipdata.plist file - if it's specifically set, I can assume it's correct.
Great to know, I actually didn't even think that the extra cargo size can get defined in the shipdata.plist.
In any case, I've uploaded v1.8 of Ship Comparisons which add the Cobra Mark IV to the list of exceptions, so you don't need to do anything for this ship now.
Many thanks, that's very nice of you :D
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship Comparison (Release)

Post by phkb »

Version 2.0 has just been released. In this version:
  • Added ship price to the list of information shown.
  • Put pitch, roll and yaw onto 1 line.
  • Added new menu option, "View standard equipment availability", which shows which standard equipment items are fitted as standard, available for optional installation, or not available at all.
  • Removed requirement to store a value in missionVariables.
  • Added option to clear ship list to Library interface.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Ship Comparison (Release)

Post by montana05 »

phkb wrote: Thu Nov 30, 2017 9:45 pm
Version 2.0 has just been released.
Sorry for being the one reporting an error again:

08:40:58.752 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (ShipComparison 2.0): TypeError: shipDef._oo_shipyard is undefined
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship Comparison (Release)

Post by phkb »

montana05 wrote:
Sorry for being the one reporting an error again:
Don't be sorry. Squashing bugs is a good thing!
montana05 wrote:

Code: Select all

08:40:58.752 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (ShipComparison 2.0): TypeError: shipDef._oo_shipyard is undefined
In this case I don't think it's Ship Comparison that has the problem (other than not checking that the value exists) - it looks like you have a ship with a "player" role that doesn't have an equivalent shipyard.plist entry. I'm not sure if that's normally an allowable scenario, but I don't think it is.

I've just posted an update, to version 2.1, which shouldn't bomb out with a Javascript error anymore. Can I get you to download this one and then cycle through all the available ships? It will output some extra log file entries that can hopefully help us track down the culprit/s.
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Ship Comparison (Release)

Post by montana05 »

In this case I don't think it's Ship Comparison that has the problem (other than not checking that the value exists) - it looks like you have a ship with a "player" role that doesn't have an equivalent shipyard.plist entry. I'm not sure if that's normally an allowable scenario, but I don't think it is.

I've just posted an update, to version 2.1, which shouldn't bomb out with a Javascript error anymore. Can I get you to download this one and then cycle through all the available ships? It will output some extra log file entries that can hopefully help us track down the culprit/s.
You are correct, thanks to your logs I found 4 ships so far:

10:58:25.254 [ShipComparison]: !!ERROR: _oo_shipyard property not set for ship Viper Carrier, key viper-carrier-player
10:58:43.572 [ShipComparison]: !!ERROR: _oo_shipyard property not set for ship Super-Sidewinder, key superSidewinderPlayer
10:59:37.870 [ShipComparison]: !!ERROR: _oo_shipyard property not set for ship Fer-de-Lance 3G+(t), key ferdelance3-playerPlusModelWithTurrets
10:59:38.363 [ShipComparison]: !!ERROR: _oo_shipyard property not set for ship Fer-de-Lance 3G+, key ferdelance3-playerPlusModel

While scrolling all ships I have installed V 2.10 isn't crashing anymore, V 2.00 stopped responding until I restarted from scratch. Btw, is there a chance to include ship mass as well ? :wink:
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship Comparison (Release)

Post by phkb »

montana05 wrote:
While scrolling all ships I have installed V 2.10 isn't crashing anymore
Well, that's good news!
montana05 wrote:
Btw, is there a chance to include ship mass as well ?
There already is, but you have to install Ship Configuration OXP to see it at the moment (which is not a light-weight decision!).
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship Comparison (Release)

Post by phkb »

montana05 wrote:
10:58:43.572 [ShipComparison]: !!ERROR: _oo_shipyard property not set for ship Super-Sidewinder, key superSidewinderPlayer
Just had a look at this one, and it appears this entry in the shipdata.plist is the problem:

Code: Select all

	// Player - for backwards compatibility
	"superSidewinderPlayer" =
	{
		like_ship = "superSidewinder_player";
	};
Because it's using "like_ship" to copy the player version, it rates as a "player" ship to the rest of the program. But, because shipyard.plist only has an entry for "superSidewinder_player", there is no "_oo_shipyard" property when I read the shipdata entry for "superSidewinderPlayer". Also, when I'm compiling the list of player ship keys, "superSidewinderPlayer" comes before "superSidewinder_player" alphabetically, so it's possible I'm hitting that one first (with no shipyard entry) and ignoring the second one (that does have an shipyard entry), because, technically, they are the same ship, so there's no need to get the second one once I have the first one.
Post Reply