Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Sponateous cargo pickup

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

Moderators: winston, another_commander, Getafix

Chrisfs
---- E L I T E ----
---- E L I T E ----
Posts: 433
Joined: Sun Sep 20, 2009 10:24 am
Location: California

Sponateous cargo pickup

Post by Chrisfs »

I'm coming across an odd bug.
When flying, just out of nowhere, I seem to pick up cargo as if I had picked it up with my fuel scoops. The text of what cargo it is appears on the screen and it's in my hold and counts towards my total. However, I never got the fuel scoop sound effect and never saw it on the main screen or the radar screen. It just appeared in my hold

Has anyone run into this before. I haven't removed any OXPs because it's a rather random occurence, so I can't reproduce it easily. I do have a cargo OXP, Pods 1.03, so that may be involved.
User avatar
Greyman
Dangerous
Dangerous
Posts: 98
Joined: Thu Jun 05, 2008 5:54 pm
Location: somewhere in the Bavarian outback

Post by Greyman »

Yes, I have had this happening to me too. But it won't happen regularly. I even thought it was some really late notification after picking up the cargo.

Greetings,
Greyman
Get the Oolite Keymapper for Mac here!
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

It's a problem with the cargopods.oxp iirc. The old scripting used inside it will sometime add some cargo scooped by an NPC somewhere else in the system to the player's hold.

Hopefully, there's going to be a new version of that oxp using javascript soon. Using javascript will avoid that legacy script bug.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Umm he's talking about Pods, which is mine and is written in JS ;) I'll have a look at it when I get a moment (don't hold your breath for that being before new year).

Out of interest, what cargo was it that was awarded, just to narrow things down?
Chrisfs
---- E L I T E ----
---- E L I T E ----
Posts: 433
Joined: Sun Sep 20, 2009 10:24 am
Location: California

Post by Chrisfs »

I hadn't kept track exactly, but it wasn't special stuff. I think I got an alloys once and perhaps a computer. I'll keep better track.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Pods should always award "something different", either something bad or not just a single unit of a given cargo (or fuel or missile). And all the pods are spawned by the game engine itself (they have role "cargopod").

And I think I coded them all to check that the scooper was player before doing any awarding. But I'll certainly double-check that.
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

if(scooper.isPlayer)

All the scripts have that in them, so either that isn't working as intended, or another oxp causes it...

Actually, i've seen other addons use a variation of:
if(scooper == player.ship)

dunno if that helps. (im having the random cargo bug too btw)

<EDIT> Okay, just checked every script in my addons folder, only other addons that use this.shipWasScooped is The Feudal States and Random Hits... They both use a variation of if(scooper == player.ship)
There are also two mentions in the vanilla scripts. (oolite-cloaking-device-pod.js oolite-default-ship-script.js)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Hmmm, I might well be remembering the wrong oxp name.

I'm pretty sure there's some oxp out there that uses legacy scripts to award cargo to the player.

Afaik this is a legacy script bug: in contrast to javascript, legacy script (the one used in v1.65) cannot always tell if cargo has been scooped by the player or not.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

The vanilla script "oolite-default-ship-script.js" uses:

Code: Select all

// script_actions handled on shipDidDock() and wasScooped().
if (this.legacy_scriptActions !== undefined)
{
	/*	legacy script_actions should be called for stations when the player
		docks, and for cargo pods when they are is scooped. No sane vessel can
		be scooped _and_ docked with. Non-sane vessels are certified insane.
	*/
	this.otherShipDocked = function (docker)
	{
		if (docker.isPlayer)
		{
			/*	IMPORTANT: runLegacyScriptActions() is a private function. It
				may be removed, renamed or have its semantics changed at any
				time in the future. Do not use it in your own scripts.
			*/
			this.ship.runLegacyScriptActions(docker, this.legacy_scriptActions);
		}
	};
	this.shipWasScooped = function (scooper)
	{
		/*	IMPORTANT: runLegacyScriptActions() is a private function. It may
			be removed, renamed or have its semantics changed at any time in
			the future. Do not use it in your own scripts.
		*/
		
		// Note "backwards" call, allowing awardEquipment: and similar to affect the scooper rather than the scoopee.
		scooper.runLegacyScriptActions(scooper, this.legacy_scriptActions);
	};
}
could this be causing it?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Hmmm, I might well be remembering the wrong oxp name.

I'm pretty sure there's some oxp out there that uses legacy scripts to award cargo to the player.

Afaik this is a legacy script bug: in contrast to javascript, legacy script (the one used in v1.65) cannot always tell if cargo has been scooped by the player or not.
CargoWreckTeaser.oxp is also a cargo adding oxp. However, it is possible in legacy scripting to determine if it was the player that scooped the cargo. I think it was two years ago that Arexack Heretic added this test to his oxp. He only made the fault that only the scoop message used this test not the awarding itself. In above report it is mentioned that also the scoop message was displayed, so it is probably not this oxp coursing the messages.
Versions 1.4 or newer of that oxp use the better JS to do this test.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

I would also suspect that you have maybe a very old version of Cargo_wrecks_teaser.oxp installed. Updating to the newest version is recommended.
User avatar
Greyman
Dangerous
Dangerous
Posts: 98
Joined: Thu Jun 05, 2008 5:54 pm
Location: somewhere in the Bavarian outback

Post by Greyman »

Hello,

I've been following this thread with quite some interest since I have the same problem as already stated above.

Having checked my OXPs I only have Pods 1.10.oxp and Pods-UPS 1.10.oxp installed. I haven't used the Cargo_wrecks_teaser.oxp for a very long time now. So maybe there's a small bug in Pods OXP?
Get the Oolite Keymapper for Mac here!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I just checked all the scripts in both, and they all check if the scooper is the player ship before doing anything (scooper.isPlayer is true).

So I'm not sure what else could be going wrong with the OXP itself, unless it's something in the underlying code somewhere in the trunk. But as I said before, if you can localise exact examples of when it happens and what cargo gets awarded it would be most helpful (from either of you). Also of course if it's repeatable, try the same circumstances with the OXP(s) disabled or removed.

PS @Chrisfs - can you update to v1.10 and see if the problem persists? Given the above input from Greyman it probably will, but it may be worth updating anyway. There was a tweak on scan class in the update plus some adjustment on role assignment, but nothing I think that would affect this question.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

ADCK wrote:
The vanilla script "oolite-default-ship-script.js" uses:
<snip>
could this be causing it?
In a roundabout way! :)

What you found is the interface that allows the latest oolite to actually run legacy scripts associated with ships. Without that no legacy scripts defined inside shipdata.plist would actually work. At all.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

There is of course the possibility that another, completely unrelated OXP is responsible. Which OXPs have you installed? If we could get a complete list, one of us may remember which ones might award cargo.
Post Reply