Page 1 of 1

Debug.OXP

Posted: Wed Mar 03, 2010 10:07 pm
by JazHaz
I want to use the Debug OXP to spawn various ships so I can make some screenshots.

However how do you launch the integrated console from within the game?

I've grabbed the Debug version for 1.73, and am using Oolite 1.73.4.

Also, just to check I understand the syntax, to spawn a ship I should use:

Code: Select all

:spawn shipname

Re: Debug.OXP

Posted: Wed Mar 03, 2010 10:24 pm
by JensAyton
JazHaz wrote:
However how do you launch the integrated console from within the game?
Assuming you have a Mac, the debug OXP adds a Debug menu, which has a Show JavaScript Console menu item. If you are not so blessed, there is no integrated console and you have to fiddle around with PyDebugConsole.
JazHaz wrote:
Also, just to check I understand the syntax, to spawn a ship I should use:

Code: Select all

:spawn shipname
The :spawn macro takes a role, not a name, but otherwise yes.

Posted: Wed Mar 03, 2010 10:40 pm
by another_commander
To be a bit more specific, fiddling with the PyDebugConsole consists of downloading it, unzipping it and running the executable before launching Oolite. You will need to have Debug.oxp already installed for communication between game and console to be established.

Re: Debug.OXP

Posted: Wed Mar 03, 2010 10:42 pm
by JazHaz
Ahruman wrote:
JazHaz wrote:
However how do you launch the integrated console from within the game?
If you are not so blessed, there is no integrated console and you have to fiddle around with PyDebugConsole.
JazHaz wrote:
Also, just to check I understand the syntax, to spawn a ship I should use:

Code: Select all

:spawn shipname
The :spawn macro takes a role, not a name, but otherwise yes.
OK, am on Windoze so have grabbed the PyDebugConsole. It seems to run OK and detects when Oolite is launched.

However upon using :spawn adder, I get the following message. Does that mean the ship is being spawned by my location? If so its not happening, no sign of an adder there?

Code: Select all

system.legacy_addShipsWithinRadius("adder", 1, 'abs', player.ship.position, 10000)

Posted: Wed Mar 03, 2010 10:44 pm
by JazHaz
another_commander wrote:
To be a bit more specific, fiddling with the PyDebugConsole consists of downloading it, unzipping it and running the executable before launching Oolite. You will need to have Debug.oxp already installed for communication between game and console to be established.
Yep, done all of this. :wink:

Re: Debug.OXP

Posted: Wed Mar 03, 2010 10:45 pm
by another_commander
JazHaz wrote:
However upon using :spawn adder, I get the following message. Does that mean the ship is being spawned by my location? If so its not happening, no sign of an adder there?

Code: Select all

system.legacy_addShipsWithinRadius("adder", 1, 'abs', player.ship.position, 10000)
There is no role "adder" in Oolite's v1.73.4 default shipdata.plist. You probably want to use the role "oolite-adder", which does exist. The ship will be spawned within 10km from your position.

Re: Debug.OXP

Posted: Wed Mar 03, 2010 11:04 pm
by JazHaz
another_commander wrote:
There is no role "adder" in Oolite's v1.73.4 default shipdata.plist. You probably want to use the role "oolite-adder", which does exist. The ship will be spawned within 10km from your position.
Ah thanks, that worked.

Now I realise how hard making the ship sit still so I can take its photo is! :lol:

Re: Debug.OXP

Posted: Wed Mar 03, 2010 11:07 pm
by another_commander
JazHaz wrote:
Now I realise how hard making the ship sit still so I can take its photo is! :lol:
Not hard at all. Target it, then on the console:

Code: Select all

PS.target.setAI("dumbAI.plist")
This should give you all the comfort and time to take as many close-ups as you feel like ;-)

Re: Debug.OXP

Posted: Wed Mar 03, 2010 11:08 pm
by JazHaz
another_commander wrote:
JazHaz wrote:
Now I realise how hard making the ship sit still so I can take its photo is! :lol:
Not hard at all. Target it, then on the console:

Code: Select all

PS.target.setAI("dumbAI.plist")
This should give you all the comfort and time to take as many close-ups as you feel like ;-)
Aha! Perfect, you read my mind!! :lol:

Re: Debug.OXP

Posted: Wed Mar 03, 2010 11:28 pm
by JensAyton
JazHaz wrote:
However upon using :spawn adder, I get the following message. Does that mean the ship is being spawned by my location? If so its not happening, no sign of an adder there?

Code: Select all

system.legacy_addShipsWithinRadius("adder", 1, 'abs', player.ship.position, 10000)
:spawn is a macro, and the above text is the expansion of the macro, i.e. the JavaScript code that is actually executed. (It should have a > in front of it, signifying that it’s “input” of sorts. I appreciate this isn’t very obvious in PyDebugConsole; it’s clearer on the Mac where different types of lines are colour-coded.)

In 1.74, :spawn will add stash the spawned ship in a variable, T, so you can do this:

Code: Select all

:spawn trader
PS.target = T
Those running a trunk build can “upgrade” to this functionality with the following command:

Code: Select all

:setM spawn this.T = system.addShips(PARAM, 1, player.ship.position, 10000); if (this.T) this.T = this.T[0]; else consoleMessage('command-error', 'Could not spawn "' + PARAM + '".');

Posted: Wed Mar 17, 2010 5:27 pm
by JazHaz
Hmmm, trying to spawn a Neolite Cobra Mk2 to take its photo.

Have tried both :spawn oolite-cobra2x and :spawn cobra2x, but neither is working.

Have I got this right?

Here is its entry in the shipdata.plist:

Code: Select all

	<key>cobra2x</key>
	<dict>
		<key>aft_eject_position</key>
		<string>0.0 4.5 -14.64</string>
		<key>ai_type</key>
		<string>route1traderAI.plist</string>
		<key>bounty</key>
		<integer>0</integer>
		<key>cargo_type</key>
		<string>CARGO_NOT_CARGO</string>
		<key>energy_recharge_rate</key>
		<real>3</real>
		<key>exhaust</key>
		<array>
			<string>17.9 -0.9 -12.0 7.0 4.0 14.0</string>
			<string>-17.9 -0.9 -12.0 7.0 4.0 14.0</string>
		</array>
		<key>forward_weapon_type</key>
		<string>WEAPON_BEAM_LASER</string>
		<key>fuel</key>
		<integer>70</integer>
		<key>has_ecm</key>
		<real>0.25</real>
		<key>has_escape_pod</key>
		<real>0.25</real>
		<key>has_fuel_injection</key>
		<real>0.125</real>
		<key>has_scoop</key>
		<real>0.75</real>
		<key>has_shield_booster</key>
		<real>0.125</real>
		<key>likely_cargo</key>
		<integer>5</integer>
		<key>max_cargo</key>
		<integer>12</integer>
		<key>max_energy</key>
		<real>250</real>
		<key>max_flight_pitch</key>
		<real>1.125</real>
		<key>max_flight_roll</key>
		<real>2</real>
		<key>max_flight_speed</key>
		<real>348</real>
		<key>max_missiles</key>
		<integer>3</integer>
		<key>missile_launch_position</key>
		<string>0.0 -2.75 8.75</string>
		<key>missiles</key>
		<integer>1</integer>
		<key>model</key>
		<string>ncm2x.dat</string>
		<key>name</key>
		<string>Cobra Mark II-X</string>
		<key>shaders</key>
		<dict>
			<key>cm2x_auv.png</key>
			<dict>
				<key>fragment_shader</key>
				<string>neolite-std.fs</string>
				<key>vertex_shader</key>
				<string>neolite-std.vs</string>
				<key>textures</key>
				<array>
					<string>cm2x_auv.png</string>
					<string>cm2x-effectsmap.png</string>
					<string>cm2x-normalmap.png</string>
				</array>
				<key>uniforms</key>
				<dict>
					<key>uColorMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>0</integer>
					</dict>
					<key>uFXMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>1</integer>
					</dict>
					<key>uNormalMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>2</integer>
					</dict>
					<key>SpecularRGB</key>
					<dict>
						<key>type</key>
						<string>vector</string>
						<key>value</key>
						<string>1.0 0.7 0.5 1.0</string>
					</dict>

					<key>uTime</key>
					<string>universalTime</string>
					<key>uEngineLevel</key>
					<string>speedFactor</string>
					<key>uHullHeatLevel</key>
					<string>hullHeatLevel</string>
				</dict>
			</dict>
		</dict>
		<key>roles</key>
		<string>trader(0.10) pirate(0.05) hunter(0.5)</string>
		<key>thrust</key>
		<real>28</real>
		<key>weapon_position_aft</key>
		<string>0.0 0.0 -16.0</string>
		<key>weapon_position_forward</key>
		<string>0.0 0.0 25.0</string>
		<key>weapon_position_port</key>
		<string>-31 0.0 0.0</string>
		<key>weapon_position_starboard</key>
		<string>31 0.0 0.0</string>
	</dict>

Posted: Wed Mar 17, 2010 6:55 pm
by JensAyton
You need to add a unique role, and spawn that.

Posted: Wed Mar 17, 2010 7:02 pm
by JazHaz
Ahruman wrote:
You need to add a unique role, and spawn that.
Don't know what you mean. Someone help me out please!

Posted: Wed Mar 17, 2010 7:02 pm
by Commander McLane
:spawn takes, like the underlying ship-adding method, one of the ship's roles as argument. According to the shipdata you posted your ship has the following roles:

Code: Select all

		<key>roles</key>
		<string>trader(0.10) pirate(0.05) hunter(0.5)</string>
So, as it is, you can only spawn it using "trader", "pirate", or "hunter". Obviously this isn't optimal, because in each case you may get any of the ships with the specified role, and may have to continue virtually forever until Oolite's pseudo-random generator chooses your ship.

So, before being able to spawn your ship specifically, you have to give it a specific role. I would suggest you use something like "neolite-cobra2x". This should be sufficiently unique that there is no other ship named like that.

Note: I would suggest that in the next release of neolite all ships get a unique role following this convention.

Practically: change the above line to

Code: Select all

		<key>roles</key>
		<string>trader(0.10) pirate(0.05) hunter(0.5) neolite-cobra2x</string>
save, start Oolite with SHIFT, and you will henceforce be able to use :spawn neolite-cobra2x in order to have the ship appear.

Posted: Wed Mar 17, 2010 7:14 pm
by JazHaz
Commander McLane wrote:
Practically: change the above line to

Code: Select all

		<key>roles</key>
		<string>trader(0.10) pirate(0.05) hunter(0.5) neolite-cobra2x</string>
save, start Oolite with SHIFT, and you will henceforce be able to use :spawn neolite-cobra2x in order to have the ship appear.
Great! Thanks very much!

Sorry for being thick! :evil: