Error with 'like_ship" statement

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Error with 'like_ship" statement

Post by Gunney_Plym »

Not sure is this is new, searching for 'like_ship' brought back too many responses to check them all.

In another thread I've been pointed towards the 'like_ship' statement in order to simplify my shipdata.plist file. Especially when defining several versions of the same vessel.

I have found that the 'like_ship' statement, as defined by the WIKI doesn't work and that what is actually required is 'like-ship' ie hythen not underscore. This simple difference has caused a fair few hours of confusion.

I'm running Oolite version 1.71.2 under WinXP in case this is a build specific issue.

*** Edit for incorrect case usage
Last edited by Gunney_Plym on Mon Nov 03, 2008 1:09 pm, edited 1 time in total.
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

It should be like_ship (no capital letters, underscored).
Like-Ship does not even appear anywhere in the source code.
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Post by Gunney_Plym »

:oops: My bad.

I had indeed used all-lower in the plist files, but I forgot when posting the above.

Original post corrected.
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Actually, the wiki has got it right. It is like_ship and not like-ship. I am not sure how you managed to get it to work, because like-ship with a hyphen is not mentioned anywhere in the source code either.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

"like_ship" works fine for me on 1.71.2 under XP. Most odd...

My missile rack OXP uses it, give that a try and see if it works for you? (or use it as a reference if you prefer).
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Post by Gunney_Plym »

Most odd indeed.

I've several instances in the shipdata.plists. If I use the hythen then all is shiney but if I underscore then I get the below in the stderr.txt file
2008-11-03 13:28:38.525 oolite.exe[3016] [universe.getShip.unknown]: Attempt to create ship of type "LeopardBase", but no such type could be found.
2008-11-03 13:28:38.525 oolite.exe[3016] [universe.getShip.badReference]: Failed to construct ship dictionary for "PdG_LeopardB" -- like_ship reference to unknown ship type "LeopardBase".
Also the demoships entry brigs up the yellow question mark.

LeopardBase being the ship upon other versions are, well ... , based and PdG_LeopardB being one of the derivative. Exactly the same idea is used for three more base ships and an armful of derivatives (like that word :) ) of each without error.
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Post by Gunney_Plym »

Snippet of shipdata in case anybody case see my mistake.
"PdG_LeopardBase" =
{
accuracy = 8;
aft_eject_position = "0.0 0.0 -30.5";
ai_type = "route1traderAI.plist";
bounty = 0;
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 5;
exhaust = ("45.0 -8.5 -28.79 6.0 6.0 10.0",
"-45.0 -8.5 -28.79 6.0 6.0 10.0",
"35.0 6.6 -28.79 6.0 6.0 10.0",
"-35.0 6.6 -28.79 6.0 6.0 10.0");
forward_weapon_type = "WEAPON_BEAM_LASER";
fuel = 100;
has_ecm = 0.95;
has_escape_pod = 0.85;
has_fuel_injection = 0.5;
has_scoop = 0.65;
laser_color = "orangeColor";
likely_cargo = 3;
max_cargo = 30;
max_energy = 300;
max_flight_pitch = 1.20;
max_flight_roll = 2.20;
max_flight_speed = 400;
max_missiles = 4;
missiles = 3;
missile_launch_position = "-6.0 -4.0 44.5";
model = "leoparda.dat";
name = "LeopardBase";
smooth = no;
thrust = 50;
weapon_energy = 15;
view_position_forward = "0.0 4.0 42.0";
view_position_aft = "0.0 2.0 -30.0";
view_position_port = "-4.4 4.0 37.0";
view_position_starboard = "4.4 4.0 37.0";
subentities = ("PdG_LaserPoint 45.0 -8.5 31.21 1 0 0 0",
"PdG_LaserPoint -45.0 -8.5 31.21 1 0 0 0",
"PdG_LaserPoint 35.0 6.6 31.21 1 0 0 0",
"PdG_LaserPoint -35.0 6.6 31.21 1 0 0 0",
"PdG_PlasmaTurret 7.0 -1.1 -31.0 1 0 0 0",
"PdG_PlasmaTurret -7.0 -1.1 -31.0 1 0 0 0",
"PdG_PlasmaTurret 0.0 4.95 15.0 1 0 0 0",
"PdG_PlasmaTurret 0.0 -5.4 15.0 1 0 0 0");
};
"PdG_LeopardA" =
{
like_ship = "LeopardBase";
model = "leoparda.dat";
name = "Leopard";
roles = "pdgLeopard(0.45) pdgSetAHigh(0.2)";
};
"PdG_LeopardB" =
{
like_ship = "LeopardBase";
model = "leopardb.dat";
name = "Leopard";
roles = "pdgLeopard(0.45) pdgSetBHigh(0.2)";
};
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

If you replace like_ship with like-ship you do not get any errors. This is not because like-ship is correct, but because it is an unknown key and, as such, it is ignored. I would be surpised if any of your like-ships work as intended, though. I would expect bugs in their behaviour.

Have you tried:
like_ship = "PdG_LeopardBase";
?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

You also need to like_ship to PdG_LeopardBase NOT LeopardBase. name = " means the name on the ID Computer. When like_shiping it needs to be to the "PdG_LeopardBase" as thats what you've called the orginal entry.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Post by Gunney_Plym »

Just downloaded and looked at Thargoids rack (oo-er :shock: ) and come to the same conclusion.

I'll make the changes and see what happens.
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
User avatar
Gunney_Plym
Dangerous
Dangerous
Posts: 64
Joined: Wed Jun 25, 2008 12:22 pm
Location: Sol 3, mostly.

Post by Gunney_Plym »

Thanks guys, all sorted.

I think my mistake stemmed from the fact that the WIKI refers to the name which I took to be the name entry within the definition rather than the name of the definition.

Interesting how it appeared to work with the hythen though, both with the demo screen and in-game proper.
Gunney.

"In space nobody cares if you scream"

Wiki Page : http://wiki.alioth.net/index.php/User:Gunney_Plym
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Gunney_Plym wrote:
Just downloaded and looked at Thargoids rack (oo-er :shock: ) and come to the same conclusion.
:oops: :oops: :lol: :oops: :oops:
Post Reply