Page 1 of 1

Ore Processor v1.56 not processing!

Posted: Mon May 31, 2010 11:51 pm
by Switeck
I'm using Ore Processor v1.56 with Windows Oolite version 1.73.4 ...on an old Celeron 2 Ghz desktop (actually midtower case) with 1 GB ram and GeForce 4 MX 64 MB ram vid card. Directx 9.0c, latest Java version from Sun, Win XP Pro SP3.

OXPs I was using:
BountyScannerv1.07.oxp
clearskies.oxp
DeepSpacePirates 1.2.4.oxp
display_reputation.oxp
Dredgers 2.4.2.oxp
Fuel Tank v2.2.oxp
FuelCollectorV0.06.oxp
Misjump Analyser 1.0.oxp
Missile Analyser 1.1.1.oxp
Pirate_coves 1.2.1.oxp
RepairBots 1.10.oxp
Rock_Hermit_Locator1.3.1.oxp
SaveAnywhere.oxp
sell_equipment.oxp
Target Autolock 1.01.oxp
total_patrol.oxp
Traffic Control 1.01.oxp
Welcome Mat 1.06.oxp

These 3 allow me to find more asteroids and rock hermit/pirate coves:
DeepSpacePirates 1.2.4.oxp
Pirate_coves 1.2.1.oxp
Rock_Hermit_Locator1.3.1.oxp


And the Ore Processor "breaks" on me. It keeps making its noises continually without stop even when nothing is left to process. I have to exit the game to get it to stop. Worse, any asteroid shards I scoop up after that don't get processed and it seems I can't dump them either.

I'm not a great programmer but I think I fixed it...

In the op_splinter.js file, I changed from this:
if(quantity > 1) {message = message.replace("gr ", "grs "); message = message.replace("kilogram ", "kilograms ")};

to this:
if(quantity > 1) {message = message.replace("gr ", "grs "); message = message.replace("kilogram ", "kilograms ")}
else quantity=1;

(Because I reduced the amount of gems, gold, and platinum down to only 1-7 per shard, I found sometimes it got 0...so in that case it will round up to 1.)


In the OreProcessor.js file, I changed from this:
if(this.message.length==0) {this.oreTimer.stop(); this.mySound.stop();}
else if(!this.canAwardCargo(this.type[0], this.quantity[0])) this.count[0] = 2;

to this:
if(this.count[0]<1) {this.oreTimer.stop(); this.mySound.stop();}
else if(!this.canAwardCargo(this.type[0], this.quantity[0])) this.count[0]--;

I wanted to avoid the counter "overshooting" zero and I didn't trust the message length being a clear indicator of when it's done, so I used <1 instead. I also had the else reduce the count by 1 instead of setting it to 2.

Sadly, that did nothing for the continuous sounds...so I did this also:
// this.mySound.loop = true; // NO MORE LOOPING SOUNDS!

and...
this.mySound.play() // Instead of looping, play the extraction sound 7 times.
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()

Posted: Tue Jun 01, 2010 7:53 am
by Eric Walch
if(quantity > 1) {message = message.replace("gr ", "grs "); message = message.replace("kilogram ", "kilograms ")}
else quantity=1;
I originally did not do this because the "void" containers said "0 ton of .....". But, somehow I found "1 ton of emptiness" sounding better so now the lowest value used is 1. Still strange that you get zero as "Math.ceil()" should always round up. Math.random() could become 0.0000000 but that should be very, very rare.
I'll change the code to your suggestion as it is more fool proof.

To the looping sound: On my mac I experience the opposite. When scooping several splinters in a row, the looping stops even before I execute the stop() command. I'll take another look at the code. Maybe there is an exception I missed that makes the stop() command is sometimes not executed and that is masked on my system were the looping always stops after some time.

Does the looping also not stop by scooping a new splinter so a new stop() is executed at the end? Any others had this looping sound not stopping?

Posted: Tue Jun 01, 2010 10:07 am
by Micha
I've had continuous scoop/ore processing sounds in the past, but they did stop on scooping the next splinter.
IIRC there was (is?) a bug which had objects orbiting around the scoop rather than being sucked in.

Haven't had time to play for ages, unfortunately, so I'm a bit hazy on details, and won't get time to test until next week at the earliest. Just a heads-up that Switeck isn't the only one. Oh, and this would be under Linux, not Windows.

Re: Ore Processor v1.56 not processing!

Posted: Tue Jun 01, 2010 2:11 pm
by JensAyton
Switeck wrote:
and...
this.mySound.play() // Instead of looping, play the extraction sound 7 times.
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()
this.mySound.play()
You can also write this.mySound.play(7).

Posted: Tue Jun 01, 2010 4:40 pm
by Eric Walch
Micha wrote:
I've had continuous scoop/ore processing sounds in the past, but they did stop on scooping the next splinter.
IIRC there was (is?) a bug which had objects orbiting around the scoop rather than being sucked in.
While processing ore a new splinter can be scooped. Maybe things do sometimes go wrong on multiple item scoops.

Replacement of the "loop" by just playing the sound a fixed numbers of times is probably the best fix. When things now go wrong, the sound will at least stop by itself.

I reworked the code a bit according the proposition by Switeck and came up with Ore Processor 1.57 (test).

The replacement of if(this.message.length==0) by if(this.count[0]<1) is not correct at the first counts the splinters on stack while the other counts a loop within a splinter leading to stop the sound even when there are more splinters waiting for processing.

Enclosed version works well on my mac and should stop any endless looping sound.

Posted: Tue Jun 01, 2010 4:42 pm
by Switeck
this.mySound.play(7) ...would certainly be useful instead of looping the sound.

I park my ship ~0.04km from an asteroid, blast it with a mining laser till there's nothing but shards, then quickly scoop them up before they drift apart. Sometimes there are >5 to-be-processed shards inside my ship at once. It's my guess that extreme condition could be just enough to goof up the script.

When I get the continuous sounds, nothing seems to make it go away. Certainly not scooping another shard that needs to be processed -- it seems to do nothing at all, I don't even get a ton of minerals from it. :(

As for game balance, the original settings for the Ore Processor really are too good. Without that OXP, a player will only get about 10 tons of minerals per asteroid worth about 100 Credits. With it, the player will still get the 10 tons of minerals but will also get about 10 shards that give Radioactives, Alloy, Gold, Platinum, and Gemstones. Assuming there were 2 shards of each kind...altogether there would be:
10 tons Minerals (at 10 Cr. each) = 100 Cr.
2 tons Radioactives (at 20 Cr. each) = 40 Cr.
2 tons Alloy (at 40 Cr. each) = 80 Cr.
6 kg of Gold (at 40 Cr. each) = 240 Cr.
6 kg of Platinum (at 80 Cr. each) = 480 Cr.
10 g of Gemstones (at 20 Cr. each) = 200 Cr.
So the total value would be around 1140 Credits...over 10 times better than without. That's why I reduced the amount of Gold, Platinum, and Gemstones I could get from 1 shard. The other shards never give something worth more than 100 Credits, so seems fair to never get much more than that even for Gold, Platinum, or Gemstones.

Posted: Tue Jun 01, 2010 4:51 pm
by Eric Walch
Switeck wrote:
I park my ship ~0.04km from an asteroid, blast it with a mining laser till there's nothing but shards, then quickly scoop them up before they drift apart. Sometimes there are >5 to-be-processed shards inside my ship at once. It's my guess that extreme condition could be just enough to goof up the script.
To really bring multiple scoops to a test I usually ram the boulder directly with my ship. #1 (no laser used at all). You need a strong ship for this, like the BCC. That way a large part of the splinters is scooped up at once.

About the earnings: You are probably right. I should reduce the gold/platinum/gem content.

#1: In Oolite 1.74, the boulders will have a higher density than before, making ramming a bit more dangerous

Posted: Thu Jun 03, 2010 12:25 am
by Switeck
I've been ramming using the starting Cobra -- seems tough enough to handle boulders...or even asteroids at low speed.

I still had problems with Ore Processor 1.57 (test).
...So I made some changes. :lol:

In Scripts\OreProcessor.js
this.processOre = function ()

It was this:
if (this.message.length > 0)
{
this.mySound.play(10); // reset the counter for next splinter
if (!this.canAwardCargo(this.type[0], this.quantity[0])) this.count[0] = 2;

But due to this (message suppression?):
if (this.toggle) this.toggle=false; else this.toggle = true; // to avoid identical message supression.
...I'm thinking "if (this.message.length > 0)" isn't a good check.

If my guess is correct, and I'm understanding the variable names at all...so long as there's splinters left to count there needs to be a continuation of processing. So I changed the above to this:

if (this.count[0] > 0)
{
this.mySound.play(10); // reset the counter for next splinter
if (!this.canAwardCargo(this.type[0], this.quantity[0])) this.count[0]--;

Notice the use of this.count[0]--; instead of this.count[0] = 2;

Posted: Sun Jun 06, 2010 11:59 am
by Eric Walch
I rewrote the code a bit so the splinters now transfer a record with the contents to the main script. Mainly because it makes the code easier to read. (and find bugs easier) In a PM with Switeck, I understood the problems with him stopped by using oolite trunk, however he still had issues with 1.73. Im not sure about the reasons for this but I blame here an Oolite bug, so I updated the ore processor.oxp on the wiki to version 1.57.

On testing the ore processor with 1.73 and an almost full hold, I noticed a few interesting bugs.:

awardCargo("Gold", x) awards gold to the player without counting the mass while being docked. When in flight however, things are different: Every time the command is used, the added gold is put in a container and added to the cargo in a 1t-cargopod. This means that gold can not be awarded to the player when the hold is full. However, the command canAwardCargo("Gold", x) always returns true, even when in flight with a full hold. This is wrong and in 1.73 there is no way for a script to evaluate itself if it can award gold. This results in a "extracted gold" message while the code can't award the gold. So for now I blame some rare anomalies on splinter scooping with a nearly full hold to this bug.

For 1.74 this problem is gone because the faulty command canAwardCargo is gone :lol: and the script becomes responsible to do the calculations itself.

Posted: Fri Jun 11, 2010 11:42 pm
by Falconeer
Hi, just to report that I am back in the mining business again :lol:

On 1.73.4 the Ore processor upgrade to 1.57 now works fine. The processor sound switches off after about 5 seconds. If there is any improvement with 1.74 thats a bonus for me.

Best Wishes.

Posted: Sat Jun 12, 2010 5:34 am
by JazHaz
I'm still using 1.55 of the Ore Processor. Can report it works fine for me on 1.73.4.