Page 4 of 4

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 12:25 pm
by RyanHoots
Eric Walch wrote:
RyanHoots wrote:
That works, thanks. :D

I still don't really understand how it works, at least I know that it does. :)
Internally does Oolite only use the new style declarations. On building the cache on startup, all old style definitions are translated to the new one. When one of the old style subs contains a 'setup_actions' with "initialiseTurret", that subentity is defined as turret in the new style. The new style definition no longer looks at the setup_actions to see if it is a turret because it has a specific key telling it is a turret.
On the second start, Oolite gets the already converted definitions from the cache.

When you have the choice, I would always use the new definitions as that allows different specifications for the different turrets. eg. energy or speed
Hmm, interesting. So, startup actions didn't work because Oolite didn't look in that area of .plist code. Good to know for the future. :)

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 2:47 pm
by mandoman
I'm having a problem with another ship, and older creation that isn't a player ship, the Andricothere. When I first tried it out with a test_script.js, I was able to look it all over well enough to get the ball turrets in the right positions, but could never get them initialized. I went back to that ship and did basically the same to it as I did with the Genesis......but the ball turrets don't even appear anymore. In fact, I get a Latest.log warning that I'm using a "Bad" type identification. Says it should only be specified as "flasher, or ball_turret". I have the type listed as ball_turret in shipdata.plist, but the Latest.log says it's wrong. What now? I'm at a loss as to why it doesn't accept the same type as I have listed in the Genesis shipdata. :?

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 3:46 pm
by JensAyton
RyanHoots wrote:
Hmm, interesting. So, startup actions didn't work because Oolite didn't look in that area of .plist code. Good to know for the future. :)
No, that’s not what he said. In general, setup_actions work (but are deprecated, because they’re part of the legacy scripting engine). initialiseTurret is a special case; as a command, it doesn’t actually do anything, but the game looks for it to determine if a subentity is a turret.

When the new subentity declaration was introduced, this hacky mechanism wasn’t carried forward, but it’s used when internally translating old-style declarations.

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:03 pm
by mandoman
Here is what I get in Latest.log:

Code: Select all

09:56:19.840 [shipData.load.error.badSubentity]: ***** ERROR: subentity declaration for ship Andricothere Trader does not declare a valid type (must be standard, flasher or ball_turret).
Here is what I have in shipdata.plist:

Code: Select all

"subentities" = (
                        {
                                type = "ball_turret";
				subentity_key = "andricothere_ball_turret";
				position = (0.2, 54.2, 192.5);
				orientation = (1, 1, 0, 0);
			},
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
				position = (0.2, 54.2, 192.5);
				orientation = (1, 0, 1, 0);
			},
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
                                position = (0.0, -122.0, 101.0);
                                orientation = (1, -1, 0, 0);
                        },
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
                                position = (0.0, -122.0, 101.0);
                                orientation = (1, 0, -1, 0);
                        },
            {
                                type = "ball_turret";
				subentity_key = "andricothere_ball_turret";
				position = (100.25, 77.0, -74.0);
				orientation = (1, -1, 0, 0);
			},
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
                                position = (-100.25, 77.0, -74.69);
                                orientation = (1, 0, -1, 0);
                        },
            {
                                type = "ball_turret";
				subentity_key = "andricothere_ball_turret";
				position = (0.0, 102.5, -247.0);
				orientation = (1, 1, 0, 0);
			},
            {
                                type = "ball_turret";
				subentity_key = "andricothere_ball_turret";
				position = (0.0, 102.5, -247.0);
				orientation = (1, 0, 1, 0);
			},
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
                                position = (0.7, -121.0, -146.0);
                                orientation = (1, -1, 0, 0);
			},
            {
                                type = "ball_turret";
                                subentity_key = "andricothere_ball_turret";
                                position = (0.7, -121.0, -146.0);
                                orientation = (1, 0, -1, 0);
			},
            {
                                type = "dock_horizontal";
                                subentity_key = "Andricothere-dock";
                                position = (0.0, 2.327, -1.233);
                                orientation = (1, 0, 0, 0);
                        }
		);
        "forward_weapon_type" = "NONE";
        "thrust" = 3.5;
        };
        "andricothere_ball_turret" =
	{
		ai_type = "andricothere_ball_turretAI.plist";
		model = "andricoturret.dat";
		smooth = "yes";
		materials = "andricoturret.png";
		name = "Ball Turret";
		roles = "andricothere_ball_turret";
                script = "andricothere_ball_turret.js";
		thrust = 1;
		weapon_energy = 50;
That is extremely similar to what I have for the Genesis, on which the ball turrets are now working fully. Can anyone see where the mess up is, or what I've left out, or put in, that I shouldn't? Thanks.

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:09 pm
by Thargoid
I'd suspect it's not your turrets at all that are screwing things up, but perhaps the dock. Specifically

Code: Select all

type = "dock_horizontal";
Docks are defined by is_dock = true;[/color]

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:17 pm
by mandoman
Thargoid wrote:
I'd suspect it's not your turrets at all that are screwing things up, but perhaps the dock. Specifically

Code: Select all

type = "dock_horizontal";
Docks are defined by is_dock = true;[/color]
I have that in the dock description:

Code: Select all

"Andricothere-dock" =
        {
		ai_type = "nullAI.plist";
                is_dock = "true";
                materials = "Andricothere-dock.png";
		model = "andricothere-dock.dat";
		name = "Andricothere-dock (horizontal)";
		roles = "androcpthere-dock";
	};
Are you saying that it needs to be in the subentity listing?

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:22 pm
by Thargoid

Code: Select all

09:56:19.840 [shipData.load.error.badSubentity]: ***** ERROR: subentity declaration for ship Andricothere Trader does not declare a valid type (must be standard, flasher or ball_turret).

Code: Select all

type = "dock_horizontal";
The error in the log lists the three available values of type. "dock_horizontal" isn't one of them. It should be "standard", or just omitted completely (at which point standard is assumed).

And yes, is_dock should be in the subentity command of the mother, not the sub-entity itself. Look in the shipdata.plist of the trunk files for guidance (for example the entries for the Coriolis or other stations).

Just replace the type="dock_horizontal"; with is_dock=true'; and remove it from the dock's definition array.

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:29 pm
by mandoman
Thargoid wrote:

Code: Select all

09:56:19.840 [shipData.load.error.badSubentity]: ***** ERROR: subentity declaration for ship Andricothere Trader does not declare a valid type (must be standard, flasher or ball_turret).

Code: Select all

type = "dock_horizontal";
The error in the log lists the three available values of type. "dock_horizontal" isn't one of them. It should be "standard", or just omitted completely (at which point standard is assumed).

And yes, is_dock should be in the subentity command of the mother, not the sub-entity itself. Look in the shipdata.plist of the trunk files for guidance (for example the entries for the Coriolis or other stations).

Just replace the type="dock_horizontal"; with is_dock=true'; and remove it from the dock's definition array.
Okay. Thanks. I missed that "standard" as one of the conditions. Not sue why, probably because it didn't specify "dock". I'm learning, really, it's true. :)

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:44 pm
by RyanHoots
Ahruman wrote:
RyanHoots wrote:
Hmm, interesting. So, startup actions didn't work because Oolite didn't look in that area of .plist code. Good to know for the future. :)
No, that’s not what he said. In general, setup_actions work (but are deprecated, because they’re part of the legacy scripting engine). initialiseTurret is a special case; as a command, it doesn’t actually do anything, but the game looks for it to determine if a subentity is a turret.

When the new subentity declaration was introduced, this hacky mechanism wasn’t carried forward, but it’s used when internally translating old-style declarations.
I really need to figure out how to understand techno-talk a little better. Thanks for clearing that up, Ahruman.

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:49 pm
by mandoman
Thank you, Thargoid. That was exactly the problem. I'll remember that from now on. Little, by little, it becomes more clear. :)

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:50 pm
by RyanHoots
mandoman wrote:
Little, by little, it becomes more clear. :)
Well said. Same thing for me. :)

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 4:59 pm
by Thargoid
mandoman wrote:
Thank you, Thargoid. That was exactly the problem. I'll remember that from now on. Little, by little, it becomes more clear. :)
You're welcome sir. I can recall being in a similar position a few years back and people here guiding me from confusion to clarity. Now I'm happy to be able to pay that investment back.

Re: Third Plea For Help

Posted: Sun Dec 18, 2011 7:31 pm
by mandoman
Thargoid wrote:
You're welcome sir. I can recall being in a similar position a few years back and people here guiding me from confusion to clarity. Now I'm happy to be able to pay that investment back.
:D