Page 1 of 1

Fuel pod

Posted: Sat Feb 23, 2008 8:35 am
by Ark
Is there a problem with the fuelpod from cargo and wrecks oxp.?

I have scooped it several times and nothing happens. I do not get extra fuel nor do I have a fuel leak, I only get the message “fuelpod scooped”. I am wondering if this is related with the bug of awardFuel command in 1.70

Posted: Sat Feb 23, 2008 1:12 pm
by another_commander
Something seems to be going wrong in the script_actions of fuelpod1 and fuelpod2:

Code: Select all

<key>script_actions</key>
		<array>
			<string>set: local_wreck_credits [credits_number]</string>
			<string>awardCredits: 1</string>
			<string>subtract: local_wreck_credits [credits_number]</string>
			<string>awardCredits: -1</string>
			<dict>
				<key>conditions</key>
				<array>
					<string>local_wreck_credits lessthan 0</string>
				</array>
				<key>do</key>
				<array>
					<string>awardEquipment: EQ_FUEL</string>
					<string>setFuelLeak: 2.5</string>
					<string>consoleMessage6s: FuelPod Failure!</string>
				</array>
				<key>else</key>
				<array>
					<string>performScriptActionOnTarget: commsMessage: [last-words]</string>
				   <string>performScriptActionOnTarget: becomeExplosion</string>
				</array>
			</dict>
		</array>
I did some testing with the current SVN build and here are the results:
The problem comes from the subtract: local_wreck_credits [credit_number] line, which returns infinity. Some more investigation reveals that the mission_key static variable that contains the name of the script running contains (nil) when subtract is called. Most likely, other methods involving local variables that are handled in a similar manner will have issues like this. Since the same top lines repeat also for other items in cargo_wrecks.oxp, this might explain why no cargo-specific messages appear when these crates are scooped.

Posted: Sat Feb 23, 2008 2:53 pm
by JensAyton
Yeah, local variables only work for world scripts (script.plist) in the legacy system. No such problem in JavaScript. :-)

Posted: Sat Feb 23, 2008 5:59 pm
by Kaks
Hmmm, someone should add wrecks.oxp to their TODO list! :D

Posted: Mon Feb 25, 2008 12:27 pm
by Eric Walch
Ahriman wrote:
Yeah, local variables only work for world scripts (script.plist) in the legacy system. No such problem in JavaScript. :-)

They did work in Oolite 1.69. But that they worked was a bug itself. In 1.69 I could change local variables with a ship and read them out in the normal script. But when a variable is local to a certain script, than the ship should not be able to generate a local variable that is usable by an other script. In 1.70 this is corrected. In UPS I changed them to mission_variables. I thing Cargo_wreck should also change those "local_wreck_credits" into "mission_wreck_credits"
Ark wrote:
I have scooped it several times and nothing happens. I do not get extra fuel nor do I have a fuel leak, I only get the message “fuelpod scooped”. I am wondering if this is related with the bug of awardFuel command in 1.70
It's the same bug. It uses "awardFuel" that is not working in 1.70. changing in "addFuel" should do the trick. (Or wait until Oolite 1.71)

Posted: Mon Feb 25, 2008 4:15 pm
by JensAyton
Hmm. I think it’d be possible for foo_actions to have their own temporary local variables (rather than “accidentally” sharing those of the last named script). Assuming it doesn’t lead to complications, that would probably be best for compatibility.

Edit: Yep, that was simple enough.

Posted: Mon Feb 25, 2008 4:28 pm
by Ark
Eric Walch wrote:
They did work in Oolite 1.69. But that they worked was a bug itself.
Poor A_H.
From what I know he did all the testings on 1.69
Eric Walch wrote:
It's the same bug. It uses "awardFuel" that is not working in 1.70. changing in "addFuel" should do the trick. (Or wait until Oolite 1.71)
I have already changed it but the fuelpod still do not work right due to the local variables.
I wanted to implement this method to Dr Nill’s ore processor, test it and finally PM Dr nill and recommend it as a nice upgrade to ore processor (and also for the scripted cargo in oohaul).
Unfortunately I took as example the code from cargo_wrecks.oxp and not that from UPS. Imagine the horrible moments I had (given the fact that I am not very good at scripting) trying to understand what I did wrong.
:x :x

Posted: Mon Feb 25, 2008 4:33 pm
by another_commander
Actually, I would think that awardFuel had been fixed to work on script target on 1.70. Ark, try editing the script_actions for fuelpod in shipdata.plist to

Code: Select all

<key>script_actions</key>
		<array>
			<string>awardFuel: 1.0</string>
			<string>commsMessage: 1.0 LY Fuel Transfered!</string>
		</array>
for fuelpod1 and

Code: Select all

<key>script_actions</key>
		<array>
			<string>awardEquipment: EQ_FUEL</string>
			<string>setFuelLeak: 2.5</string>
			<string>commsMessage: FuelPod Failure!</string>
		</array>
for fuelpod2. You should be able to have fuel awarded or leaked, depending on what fuelpod you scoop and this should also work with NPC ships.

Posted: Mon Feb 25, 2008 4:44 pm
by Eric Walch
Anather Commander wrote:
Actually, I would think that awardFuel had been fixed to work on script target on 1.70. Ark, try editing the script_actions for fuelpod in shipdata.plist to
Not in the plain 1.70 version. And those starting checking lines are necessary. Without then any NPC ship scooping a pod would give the player fuel. Remember the OXP is not only is used on 1.70+ but has to work also on 1.65 and earlier.

Posted: Mon Feb 25, 2008 4:45 pm
by Ark
Thanks A_C :D
I will try it.

Posted: Mon Feb 25, 2008 4:56 pm
by another_commander
Eric Walch wrote:
Anather Commander wrote:
Actually, I would think that awardFuel had been fixed to work on script target on 1.70. Ark, try editing the script_actions for fuelpod in shipdata.plist to
Not in the plain 1.70 version. And those starting checking lines are necessary. Without then any NPC ship scooping a pod would give the player fuel. Remember the OXP is not only is used on 1.70+ but has to work also on 1.65 and earlier.
I agree about the pre-1.70 part of your response. If this doesn't work on 1.65, then it is not possible to use the OXP as intended. However, the awardFuel does work on 1.70 and other craft scooping fuel pods do not create leaks or award fuel to player. I run a small test with vanilla 1.70. Hyperspaced, and had a script generate some fuel pods and add a scavenger craft. Here is part of the log:

Code: Select all

2008-02-25 16:48:05.605 oolite.exe[4496] [dumpState]: State for <ShipEntity 0x17c46d30>{"Llama" ID: 275 position: (9157.52, -7771.18, -4124.34) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT}:
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Universal ID: 275
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Scan class: CLASS_NEUTRAL
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Status: STATUS_IN_FLIGHT
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Position: (9157.52, -7771.18, -4124.34)
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Orientation: (0.679456 - 0.709931i + 0.151915j - 0.106109k)
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Distance travelled: 7535.51
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Energy: 150 of 150
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Mass: 77026.4
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.entity]: Flags: isShip, hasMoved, isSunlit
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Name: Llama
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Roles: <OORoleSet 0x1c556ba8>{scavenger sunskim-trader trader}
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Primary role: scavenger
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Script: <OOJSScript 0x16e17220>{"oolite-default-ship-script" version 1.70.1}
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Subentity count: 7
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Behaviour: BEHAVIOUR_COLLECT_TARGET
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Target: <ShipEntity 0x19f52b10>{"Fuel cannister" ID: 272 position: (9091.81, -8783.18, -4179.04) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT}
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Destination: (9091.81, -8783.18, -4179.04)
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Other destination: (0, 0, 0)
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Waypoint count: 0
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Desired speed: 300
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Fuel: 70
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Fuel accumulator: 1
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Missile count: 3
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity.ai]: AI:
2008-02-25 16:48:05.605 oolite.exe[4496]     [dumpState.ai]: State machine name: scavengerAI.plist
2008-02-25 16:48:05.605 oolite.exe[4496]     [dumpState.ai]: Current state: COLLECT_STUFF
2008-02-25 16:48:05.605 oolite.exe[4496]     [dumpState.ai]: Next think time: 84.342
2008-02-25 16:48:05.605 oolite.exe[4496]     [dumpState.ai]: Next think interval: 84.342
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Frustration: 0
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Success factor: 1018.61
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Shots fired: 0
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Time since shot: 100028
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Spawn time: 56.385 (27.932 seconds ago)
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Hull temperature: 60
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Heat insulation: 1
2008-02-25 16:48:05.605 oolite.exe[4496]   [dumpState.shipEntity]: Flags: has_scoop, has_escape_pod, escortsAreSetUp, isFrangible
2008-02-25 16:50:27.695 oolite.exe[4496] [dumpState]: State for <ShipEntity 0x17c46d30>{"Llama" ID: 275 position: (12675.4, 1366.78, -3114.59) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT}:
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Universal ID: 275
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Scan class: CLASS_NEUTRAL
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Status: STATUS_IN_FLIGHT
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Position: (12675.4, 1366.78, -3114.59)
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Orientation: (0.21143 - 0.750934i - 0.154663j + 0.606197k)
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Distance travelled: 35413.8
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Energy: 150 of 150
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Mass: 77026.4
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.entity]: Flags: isShip, hasMoved, isSunlit
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Name: Llama
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Roles: <OORoleSet 0x1c556ba8>{scavenger sunskim-trader trader}
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Primary role: scavenger
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Script: <OOJSScript 0x16e17220>{"oolite-default-ship-script" version 1.70.1}
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Subentity count: 7
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Behaviour: BEHAVIOUR_COLLECT_TARGET
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Target: <ShipEntity 0x17c5ac00>{"Fuel cannister" ID: 274 position: (7501.34, -1704.88, -4188.72) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT}
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Destination: (7501.34, -1704.88, -4188.72)
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Other destination: (0, 0, 0)
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Waypoint count: 0
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Desired speed: 300
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Fuel: 0
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Fuel accumulator: 1
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Missile count: 3
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity.ai]: AI:
2008-02-25 16:50:27.695 oolite.exe[4496]     [dumpState.ai]: State machine name: scavengerAI.plist
2008-02-25 16:50:27.695 oolite.exe[4496]     [dumpState.ai]: Current state: COLLECT_STUFF
2008-02-25 16:50:27.695 oolite.exe[4496]     [dumpState.ai]: Next think time: 186.869
2008-02-25 16:50:27.695 oolite.exe[4496]     [dumpState.ai]: Next think interval: 186.869
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Frustration: 0
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Success factor: 6115.27
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Shots fired: 0
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Time since shot: 100125
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Spawn time: 56.385 (125.211 seconds ago)
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Hull temperature: 60
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Heat insulation: 1
2008-02-25 16:50:27.695 oolite.exe[4496]   [dumpState.shipEntity]: Flags: has_scoop, has_escape_pod, escortsAreSetUp, isFrangible
2008-02-25 16:51:09.049 oolite.exe[4496] [gameController.exitApp]: .GNUstepDefaults synchronized. Exiting.
The first part of the entity dump is the scavenger at initial state. The second dump is after it had scooped a pod. You will see that its fuel has dropped to 0, as expected, without me (the player) experiencing any leak. But I did get a leak after scooping one of these pods myself. So, setFuelLeak works as intended. And below is the check for awardFuel itself:

Code: Select all

2008-02-25 18:09:43.716 oolite.exe[4240] [dumpState]: State for <ShipEntity 0x19625d50>{"Llama" ID: 277 position: (-2484.57, -1856.92, 4070.1) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT}:
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Universal ID: 277
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Scan class: CLASS_NEUTRAL
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Status: STATUS_IN_FLIGHT
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Position: (-2484.57, -1856.92, 4070.1)
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Orientation: (-0.815527 - 0.323781i - 0.402552j - 0.260831k)
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Distance travelled: 39245.4
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Energy: 150 of 150
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Mass: 77026.4
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.entity]: Flags: isShip, hasMoved, hasRotated, isSunlit, collisionTestFilter
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Name: Llama
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Roles: <OORoleSet 0x182217d0>{scavenger sunskim-trader trader}
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Primary role: scavenger
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Script: <OOJSScript 0x217fafa0>{"oolite-default-ship-script" version 1.70.1}
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Subentity count: 7
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Behaviour: BEHAVIOUR_COLLECT_TARGET
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Target: <ShipEntity 0x169d9430>{"Fuel cannister" ID: 275 position: (-2479.03, -1879.82, 4061.51) scanClass: CLASS_CARGO status: STATUS_BEING_SCOOPED}
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Destination: (-2479.03, -1879.82, 4061.51)
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Other destination: (0, 0, 0)
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Waypoint count: 0
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Desired speed: 300
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Fuel: 0
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Fuel accumulator: 1
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Missile count: 3
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity.ai]: AI:
2008-02-25 18:09:43.716 oolite.exe[4240]     [dumpState.ai]: State machine name: scavengerAI.plist
2008-02-25 18:09:43.716 oolite.exe[4240]     [dumpState.ai]: Current state: COLLECT_STUFF
2008-02-25 18:09:43.716 oolite.exe[4240]     [dumpState.ai]: Next think time: 199.607
2008-02-25 18:09:43.716 oolite.exe[4240]     [dumpState.ai]: Next think interval: 199.607
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Frustration: 0.26
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Success factor: 24.4813
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Shots fired: 0
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Time since shot: 100140
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Spawn time: 59.807 (139.765 seconds ago)
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Hull temperature: 60
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Heat insulation: 1
2008-02-25 18:09:43.716 oolite.exe[4240]   [dumpState.shipEntity]: Flags: has_scoop, has_escape_pod, escortsAreSetUp, isFrangible
2008-02-25 18:10:10.908 oolite.exe[4240] [dumpState]: State for <ShipEntity 0x19625d50>{"Llama" ID: 277 position: (-1295.5, -1135.74, 2828.16) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT}:
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Universal ID: 277
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Scan class: CLASS_NEUTRAL
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Status: STATUS_IN_FLIGHT
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Position: (-1295.5, -1135.74, 2828.16)
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Orientation: (0.100142 - 0.887736i - 0.153667j - 0.422237k)
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Distance travelled: 42967.3
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Energy: 150 of 150
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Mass: 77026.4
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.entity]: Flags: isShip, hasMoved, isSunlit, collisionTestFilter
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Name: Llama
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Roles: <OORoleSet 0x182217d0>{scavenger sunskim-trader trader}
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Primary role: scavenger
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Script: <OOJSScript 0x217fafa0>{"oolite-default-ship-script" version 1.70.1}
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Subentity count: 7
2008-02-25 18:10:10.908 oolite.exe[4240]   [dumpState.shipEntity]: Behaviour: BEHAVIOUR_COLLECT_TARGET
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Target: <ShipEntity 0x18ac0cc0>{"Fuel cannister" ID: 276 position: (7501.34, -1704.88, -4188.72) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT}
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Destination: (7501.34, -1704.88, -4188.72)
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Other destination: (0, 0, 0)
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Waypoint count: 0
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Desired speed: 300
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Fuel: 10
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Fuel accumulator: 1
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Missile count: 3
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity.ai]: AI:
2008-02-25 18:10:10.928 oolite.exe[4240]     [dumpState.ai]: State machine name: scavengerAI.plist
2008-02-25 18:10:10.928 oolite.exe[4240]     [dumpState.ai]: Current state: COLLECT_STUFF
2008-02-25 18:10:10.928 oolite.exe[4240]     [dumpState.ai]: Next think time: 212.126
2008-02-25 18:10:10.928 oolite.exe[4240]     [dumpState.ai]: Next think interval: 212.126
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Frustration: 0
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Success factor: 11270
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Shots fired: 0
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Time since shot: 100152
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Spawn time: 59.807 (152.214 seconds ago)
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Hull temperature: 60
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Heat insulation: 1
2008-02-25 18:10:10.928 oolite.exe[4240]   [dumpState.shipEntity]: Flags: has_scoop, has_escape_pod, escortsAreSetUp, isFrangible
See how the Llama is going from 0 fuel to 10, after it has scooped up a green fuelpod.

Edit: You can ignore the 1.70.1 mentioned in the script version running. It is actually a 1.70 executable that is being used.
Edit 2: Added the test for awardFuel itself.

Posted: Mon Feb 25, 2008 9:24 pm
by Eric Walch
I am probably confusing things. "awardFuel" didn't work in 1.70's AI scripting for fuelPod.oxp. I just assumed it didn't work for ships at all.

There are only a few commands that are explicitly excluded to work in ship scripts:

Code: Select all

awardCredits:
awardShipKills:
awardEquipment:
removeEquipment:
awardCargo:
removeAllCargo
The checking was done to differentiate for player/npc. Probably it was not necessary with the fuel pods. But is was necessary to use in combination with consoleMessages. Without this check you got those messages when a NPC ship shooped them.And console messages are better in this case as this means an internal generated message from the ships console as commsMessages are messages that are broadcasted by external objects.

Changing the word "local" into "mission" in those ships will also work and then everything works as intended. From version 1.63 onwards. (Introduction of the consoleMessage)

Posted: Tue Feb 26, 2008 7:09 am
by another_commander
The problem with the FuelPod(Tank).oxp is that scriptActionOnTarget is not setting script target correctly with 1.70 (fixed already for next release). This may lead one to think that awardFuel is not working, when in fact the problem is somewhere else with that OXP, so I can see how confusion can be created.

As for the consoleMessage issue and the check for player / NPC, you are absolutely correct. I am indeed getting console messages when NPCs scoop stuff, when obviously this is not intended. So the local_* to mission_* change is indeed the recommended way to go about it here.

Posted: Sun Mar 09, 2008 12:34 pm
by Arexack_Heretic
*Mewls*

Thank you all for figuring this out, I'll keep lurking in the background and let you do all the hard work.
I'm loathe to fix stuff if it gets re-fixed again next reslease. :p

*scuttles off*