Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Jan 18, 2018 5:43 pm

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Dec 14, 2017 9:34 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1871
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Can I get someone to confirm this? I've been going round in circles for an hour and I need a second opinion.

So, in a completely pristine 1.87 install, I added the following script file:
Code:
"use strict";
this.name        = "TestOXP";

this.startUpComplete = function() {
    player.ship.manifest["gold"] += 50;
}
this.$test = function() {
    player.ship.manifest["gold"] -= 50;
}
Start a new game, check the F8 screen to ensure our gold has been added, and launch.

Then, using the debug console, run this command to execute the $test function:
Code:
worldScripts.TestOXP.$test()
If your experience is the same as mine, if you then go to the F8 screen, you will see that the 50kg of gold is still there. (Note: the function will work if you are still docked).

Let's change this up a bit. Adjust the script file so it looks like this:
Code:
"use strict";
this.name        = "TestOXP";

this.startUpComplete = function() {
    player.ship.manifest["minerals"] += 1;
    player.ship.manifest["gold"] += 50;
}
this.$test = function() {
    player.ship.manifest["gold"] -= 50;
}
Then do the same thing: new game, launch, and run the $test function via the debug console.

This time it's different: now the gold has been successfully removed, leaving just the minerals.

I've tested this with a number of different "t" commodities, and with other "kg" or "g" variations, and in all cases, the "kg"/"g" types will not get removed if there is zero amount of any "t" type commodities on board.

Can someone else confirm this behaviour, or am I going mad? Or maybe it's a feature...

_________________
My OXP's


Top
   
PostPosted: Thu Dec 14, 2017 10:15 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5034
I think we can call this a bug. Something happens during the conversion of g/kg to g/kg-in-tonne-canisters or with its handling.

I did a small variation of your test, which was just running the commodity removal command manually from the console and I noticed this pattern:
- You start with 50kg of gold awarded by your script at startup. This is gold stored in the ship's "safe".
- Launch. If you go to the F5/F5 screen you can see it is listed as 50 kg x Gold.
- If you execute PS.manifest["gold"] -= 50 from the console, nothing happens.
- Now execute PS.manifest["gold"] += 1 in the console. You will find that this works even when in space. Check your F5/F5. See the difference? It reports 51 kg x Gold (1TC). Now all the gold is stored in a canister.
- Do a PS.manifest["gold"] -= 51 from the console. All gold is now removed, most likely because it was considered a full canister. This is the current workaround if you want to remove g/kg quantities in-flight without any other 1t canisters present at the moment.

The fact that this behaviour is not the same when there are already 1t canisters present in the hold is what makes me thing this is a bug.


Top
   
PostPosted: Thu Dec 14, 2017 10:40 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5034
Guess what, this goes back all the way to at least 1.82. And here is an additional test.
- Start game, before launching award any amount (let's say 32 kg) of gold. Remember this amount.
- Now launch. Gold is reported as 32 kg x Gold.
- Award any additional amount of gold, say to get us to 48 kg. Cargo report says 48 kg x Gold (1TC).
- Now remove a small amount, so that you don't fall below the initial quantity of 32 kg. Example: PS.manifest["gold"] -= 4. Reported cargo: 44 kg x Gold (1TC)
- Now remove more gold so that you get to the initial quantity or less. Example: PS.manifest["gold"] -= 13 to get to 31 kg. Cargo report: 31 kg x Gold (without the TC part).
- At this point, you cannot remove any more gold.


Top
   
PostPosted: Thu Dec 14, 2017 10:46 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1871
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Well, I’m glad to know it wasn’t just me! Phew! Kept adjusting my code thinking the problem must be there somewhere and kept hitting the same issue... ah the joys of programming!

_________________
My OXP's


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited