Page 1 of 1

I am robbed

Posted: Mon Feb 23, 2009 9:33 pm
by Eric Walch
Strange thing just happened to me. My credits account was over 3 000 000 cr. I left my ship unattended hanging just outside the station aegis for a few hours. when coming back I flew the last part to the station, docked, refuelled and repaired my damaged energy bomb. As last I wanted to repair my shield boosters. This needed repair was the main reason I flew to this level 13 system.

Repair didn't work. I tried several times but always heard a beep. Then I noticed my account. 3820.5 credits and repair is 7375 cr. Clearly to low. There is something fishy going on. I don't know if I am robed during my absence or during buying fuel or repairing the bomb.

Strange thing however is that equipment that it to expensive to buy normally does not show at all. But I now see the repair: Shield boosters option and also the Maintenance Overhaul of 8000.0 cr And even the Galactic Hyperdrive.

I saved under a new name, restarted Oolite with cleared cache and opened that file again. Still to low credits and things for sale that I can not afford.

-----
Went back to me previous saved file in a system earlier: 4223.3 credits. So the robbing took place before.

Than I opened a still older file: 3 503 241.9 credits. Oeff. Saved my money and only 1 day old that file. I normally use a new name only every few weeks.

Was this a bug or an oxp that robs people?

------
Remembering what I did in the meantime was working on the oo-haul script. Hmm. That oxp uses a js script for the subentities. But that is not only used for the mission script but for all oo-haul ships. I added a few lines, but those should only be active for the mission ship. They should be changed to:

Code: Select all

this.shipDied = function(whom, why)
{
	this.ship.owner.spawn("oohaulcargo", 10);
	if(this.ship.owner.primaryRole = "oohaulermisgo")
	{
		missionVariables.oohaul_credits -= 500 // decrement credits with 500 on each death.
		if(--missionVariables.oohaul_cargo == 0) missionVariables.oohaul_credits = 500  // decrement by one. And when zero set credits to 500.
	}
}
Still, I never saved during testing and only saved once after doing a full escort. And the bonus it added was written on screen and was correct. So I'm still puzzled were my money went. A few dozen times -500 to much does not account for my loss.

Posted: Mon Feb 23, 2009 9:52 pm
by DaddyHoggy
perhaps you are responsible for every dead oo-haul ship everywhere, in the whole Ooniverse!!

Re: I am robbed

Posted: Mon Feb 23, 2009 10:11 pm
by Kaks
Hmmm,

Code: Select all

	if(--missionVariables.oohaul_cargo == 0)
checks if the variable is 0, but what happens if the variable is less than 0? It will fail to set oohaul_credits to 500! That way you could get huge negative amounts in oohaul_credits...

I'd definitely change that condition to

Code: Select all

	if(--missionVariables.oohaul_cargo <= 0)
just in case...

Posted: Mon Feb 23, 2009 10:53 pm
by tomsk
The credit crunch has reached the ooniverse.

Posted: Tue Feb 24, 2009 1:06 am
by DeepSpace
@tomsk - that is a genuis statement!!!
- Deepspace doffs his hat - :lol:

Posted: Tue Feb 24, 2009 6:10 am
by Screet
tomsk wrote:
The credit crunch has reached the ooniverse.
Maybe we need some Random Hits mission to shoot down a bankster? :twisted:

Screet

Posted: Tue Feb 24, 2009 8:20 am
by Rxke
AFAIK, equipment too expensive to buy is listed.

Posted: Tue Feb 24, 2009 8:26 am
by another_commander
Rxke wrote:
AFAIK, equipment too expensive to buy is listed.
This is correct, as can already be seen at the Lave shop.

Posted: Tue Feb 24, 2009 8:42 am
by Eric Walch
After sending my message I realised what really went wrong. OO-Haul is not to blame, although the little code error could lower the reward several times 500 credits during the mission.

What I did was adding a ship of an other mission.oxp with the console to see what happened. (according to the author this should be possible). But somehow the variables were not initialised correct and on docking I got the message: awarded NaN credits. means here an non-initialised variable. But that does not mean zero. I was just awarder an undefined amount of money. I this case a negative amount. I did save it under a new name, but made the mistake to continue with that file the next day.

So, in the end I robbed myself.

Posted: Tue Feb 24, 2009 11:22 am
by Svengali
I think we should give here some more infos. This happened when Eric has used the Vector.
Eric Walch wrote:
But somehow the variables were not initialised correct and on docking I got the message: awarded NaN credits. means here an non-initialised variable.
The worldScript initialized a missionVariable with a value of 0.01 (or it has tried to do it), but somehow it went wrong and the value has become NaN (Not a number -> C.998753...) while init or while transferring it to a property. On my computer the variable is always right initialized, so this is maybe the same problem as Eric has reported before (older processor structures) on his MAC.

I'm pretty sure that I'll go and change it from float to integer to avoid this problem.

Posted: Tue Feb 24, 2009 1:16 pm
by Eric Walch
Svengali wrote:
I think we should give here some more infos. This happened when Eric has used the Vector.
Digging deeper on the bug I discovered it had nothing to do with mine ship adding by hand. Svengali did is also himself for Vector. But one of the mission variables in my save file that should have read 0.01, now reads: C.991592789737117e+36. This value looked familiar and gave some frustration in the past. It is probably the same JS bug that only happens with oolite version 1.72.x on G4 and G5 macs. This bug is already solved for the 1.73 release. But players that use Vector.oxp on those mac systems should be warned now to watch their credits!

On all intel macs and other systems this bug should not occur.

EDIT
Or even more precise: Conversion of floating numbers in strings goes wrong on these machines. I already noticed this on printing out floating numbers but mission variables are also written as string. So any oxp on those machines using floating numbers in mission variable could be buggy. I haven't noticed any of those things in UPS but I think I only user integer numbers as mission variables. (checked: only integers are stored in ups.)

Posted: Tue Feb 24, 2009 6:05 pm
by Svengali
For all G4 and G5 user I've updated the scripts
see https://bb.oolite.space/viewtopic.php?t=4634