Page 1 of 1
Various plist things
Posted: Fri Jun 03, 2011 11:20 am
by Staer9
Moderator: belatedly split off this stuff that has nothing to do with scripting from the Scripter’s Cove thead.
Ok, so what is wrong with this?
Code: Select all
weapon_position_port = "-37.5 -4.0 -40.0";
weapon_position_starboard = "37.5 -4.0 -40.0";
materials =
{
"stardestroyerdiffuse.png" =
{
diffuse_map = "stardestroyerdiffuse.png";
illumination_map = "starglow12.png";
};
};
};
};
}
apparently there is an error around here somewhere, but I cannot find it. (this is just a part of the shipdata)
Re: Scripters cove
Posted: Fri Jun 03, 2011 11:53 am
by Commander McLane
For one, the number of opening and closing brackets doesn't match.
Code: Select all
weapon_position_port = "-37.5 -4.0 -40.0";
weapon_position_starboard = "37.5 -4.0 -40.0";
materials =
{
"stardestroyerdiffuse.png" =
{
diffuse_map = "stardestroyerdiffuse.png";
illumination_map = "starglow12.png";
};
}; <-- this one looks highly suspicious; there is no opening bracket on the same level
};
};
}
Re: Scripters cove
Posted: Fri Jun 03, 2011 11:56 am
by Smivs
Staer9 wrote:Ok, so what is wrong with this?
Code: Select all
weapon_position_port = "-37.5 -4.0 -40.0";
weapon_position_starboard = "37.5 -4.0 -40.0";
materials =
{
"stardestroyerdiffuse.png" =
{
diffuse_map = "stardestroyerdiffuse.png";
illumination_map = "starglow12.png";
};
};
};
};
}
apparently there is an error around here somewhere, but I cannot find it. (this is just a part of the shipdata)
assuming "stardestroyerdiffuse.png" is specified as the diffuse_map in the .dat file, you don't need it twice. Also there seem to be lots of closing brackets there.
Code: Select all
weapon_position_port = "-37.5 -4.0 -40.0";
weapon_position_starboard = "37.5 -4.0 -40.0";
materials =
{
"stardestroyerdiffuse.png" =
{
illumination_map = "starglow12.png";
};
};
model = "whatever-model.dat";
should do, just make sure you have the correct closing brackets at the end of the plist
Re: Scripters cove
Posted: Fri Jun 03, 2011 1:07 pm
by Staer9
Thanks, but the error remains... just on a different line, the log says:
Code: Select all
[plist.parse.failed]: Failed to parse ../AddOns/stardestroyerV1.1.oxp/Config/shipdata.plist as a property list.
Parse failed at line 41 (char 1138) - extra data after parsed string
the entire shipdata is here:
Code: Select all
{
"stardestroyer" =
{
aft_eject_position = "0.0 -20.0 -67.0";
aft_weapon_type = "WEAPON_MILITARY_LASER";
ai_type = "pirateAI.plist";
auto_ai = yes;
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 6.0;
exhaust = ("101.868 59.362 184.229 15.0 15.0 8.0", "-101.868 59.362 184.229 15.0 15.0 8.0");
forward_weapon_type = "WEAPON_MILITARY_LASER";
fuel = 70;
has_ecm = yes;
has_escape_pod = yes;
has_scoop = yes;
likely_cargo = 0;
max_cargo = 1000;
max_energy = 960;
max_flight_pitch = 0.05;
max_flight_roll = 0.05;
max_flight_speed = 100;
missile_launch_position = "0.0 -9.0 60.0";
missiles = 8;
name = "Imperial Star Destroyer";
roles = "pirate stardestroyer";
scoop_position = "0.0 -30.0 -60";
thrust = 4;
weapon_position_aft = "0.030 58.090 -151.356";
weapon_position_forward = "0.030 60.663 200.223";
weapon_position_port = "-37.5 -4.0 -40.0";
weapon_position_starboard = "37.5 -4.0 -40.0";
materials =
{
"stardestroyerdiffuse.png" =
{
illumination_map = "starglow12.png";
};
};
model = "stardestroyer.dat";
};
};
}
Re: Scripters cove
Posted: Fri Jun 03, 2011 1:17 pm
by another_commander
Too many closing curly braces. Oolite is already telling you exactly where the problem is: Line 41, extra characters encountered. The extra character is the semicolon after the curly brace.
So, in short: Lose the bottom curly brace and the semicolon in the one above it and the plist should be readable.
Re: Scripters cove
Posted: Fri Jun 03, 2011 1:21 pm
by Staer9
another_commander wrote:Too many closing curly braces. Oolite is already telling you exactly where the problem is: Line 41, extra characters encountered. The extra character is the semicolon after the curly brace.
So, in short: Lose the bottom curly brace and the semicolon in the one above it and the plist should be readable.
Ahhhhh.... thanks, it finaly worked.
Re: Scripters cove
Posted: Fri Jun 03, 2011 1:39 pm
by Commander McLane
Staer9 wrote:another_commander wrote:Too many closing curly braces. Oolite is already telling you exactly where the problem is: Line 41, extra characters encountered. The extra character is the semicolon after the curly brace.
So, in short: Lose the bottom curly brace and the semicolon in the one above it and the plist should be readable.
Ahhhhh.... thanks, it finaly worked.
You know, brace-counting should be a basic capability of anybody writing computer-legible code. A total of 4 braces opening and a total of 5 or 6 braces closing doesn't add up, regardless whether it's 5 or 6. My hint about the not-matching opening and closing braces (or brackets, or whatever) wasn't meant to make you delete one of them blindly, but was meant to make you go and actually
count them, and also to understand exactly which part of the code is enclosed by which pair of braces.
EDIT: typo
Re: Scripters cove
Posted: Fri Jun 03, 2011 1:58 pm
by DaddyHoggy
Commander McLane wrote:Staer9 wrote:another_commander wrote:Too many closing curly braces. Oolite is already telling you exactly where the problem is: Line 41, extra characters encountered. The extra character is the semicolon after the curly brace.
So, in short: Lose the bottom curly brace and the semicolon in the one above it and the plist should be readable.
Ahhhhh.... thanks, it finaly worked.
You know, brace-counting should be a basic capability of anybody writing computer-legible code. A total of 4 braces opening and a total of 5 or 6 braces closing doesn't end up, regardless whether it's 5 or 6. My hint about the not-matching opening and closing braces (or brackets, or whatever) wasn't meant to make you delete one of them blindly, but was meant to make you go and actually
count them, and also to understand exactly which part of the code is enclosed by which pair of braces.
Something like Notepad++ will actually highlight each closing bracket/brace with each corresponding open one - if you have too many of one and not enough of the other - it should be fairly obvious...
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:00 pm
by another_commander
Proper identation of brackets and code is always helpful, too. In the example above, correct identation would have made the mismatch immediately visible.
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:04 pm
by DaddyHoggy
another_commander wrote:Proper identation of brackets and code is always helpful, too. In the example above, correct identation would have made the mismatch immediately visible.
Depending on what mode you put Notepad++ in, it will auto-indent for each new open brace/bracket and de-indent (
) when it closes.
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:23 pm
by Staer9
Yet another query...
for placing subentities what I have seen in several shipdata.plist files is something like this:
what does each of the numbers mean? because from just looking at them it made no sense to me whatsoever
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:35 pm
by Commander McLane
Staer9 wrote:Yet another query...
for placing subentities what I have seen in several shipdata.plist files is something like this:
what does each of the numbers mean? because from just looking at them it made no sense to me whatsoever
Please read the documentation:
Shipdata.plist, especially
subentities, and there especially the
old-style definition. Note that your example above is also wrong. There always have to be
seven numbers after the subentity-identifier.
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:37 pm
by JensAyton
Even better, read the bit under new-style definition and use that instead.
Re: Scripters cove
Posted: Fri Jun 03, 2011 2:39 pm
by Smivs
This is on the Wkik
here. The first three numbers are the posution on the x,y,z axes, and the others are the orientation. Play around a bit and you'll soon get the hang of it.